generated from daniil-berg/boilerplate-py
make matplotlib an optional requirement
This commit is contained in:
parent
18870a3786
commit
a8636822c9
@ -1,2 +1 @@
|
|||||||
matplotlib
|
|
||||||
numpy
|
numpy
|
||||||
|
2
requirements/plt.txt
Normal file
2
requirements/plt.txt
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
-r common.txt
|
||||||
|
matplotlib
|
@ -1,6 +1,6 @@
|
|||||||
[metadata]
|
[metadata]
|
||||||
name = ccaptchas
|
name = ccaptchas
|
||||||
version = 0.1.0
|
version = 0.1.1
|
||||||
author = Daniil Fajnberg
|
author = Daniil Fajnberg
|
||||||
author_email = mail@daniil.fajnberg.de
|
author_email = mail@daniil.fajnberg.de
|
||||||
description = Character CAPTCHA Solver
|
description = Character CAPTCHA Solver
|
||||||
@ -19,12 +19,13 @@ package_dir =
|
|||||||
packages = find:
|
packages = find:
|
||||||
python_requires = >=3.9
|
python_requires = >=3.9
|
||||||
install_requires =
|
install_requires =
|
||||||
matplotlib
|
|
||||||
numpy
|
numpy
|
||||||
|
|
||||||
[options.extras_require]
|
[options.extras_require]
|
||||||
dev =
|
dev =
|
||||||
coverage
|
coverage
|
||||||
|
plt =
|
||||||
|
matplotlib
|
||||||
|
|
||||||
[options.packages.find]
|
[options.packages.find]
|
||||||
where = src
|
where = src
|
||||||
|
@ -11,7 +11,6 @@ from keras.api._v2.keras.backend import ctc_decode
|
|||||||
from .config import CONFIG
|
from .config import CONFIG
|
||||||
from .preprocess import process_image, decode_label, find_image_files, get_lookup_table
|
from .preprocess import process_image, decode_label, find_image_files, get_lookup_table
|
||||||
from .types import PathT, ImgT, Array
|
from .types import PathT, ImgT, Array
|
||||||
from .visualize import plot_images
|
|
||||||
|
|
||||||
|
|
||||||
def process_predictions(predictions: tf.Tensor) -> tf.Tensor:
|
def process_predictions(predictions: tf.Tensor) -> tf.Tensor:
|
||||||
@ -61,6 +60,7 @@ def load_and_infer(images: Sequence[ImgT], model_dir: PathT, plot_results: bool
|
|||||||
model, backward_lookup = load_inference_model(model_dir)
|
model, backward_lookup = load_inference_model(model_dir)
|
||||||
images, labels = predict_and_decode(images, model, backward_lookup)
|
images, labels = predict_and_decode(images, model, backward_lookup)
|
||||||
if plot_results:
|
if plot_results:
|
||||||
|
from .visualize import plot_images
|
||||||
per_plot = 24
|
per_plot = 24
|
||||||
for i in range(0, len(images), per_plot):
|
for i in range(0, len(images), per_plot):
|
||||||
plot_images(images[i:(i + per_plot)], labels=labels[i:(i + per_plot)])
|
plot_images(images[i:(i + per_plot)], labels=labels[i:(i + per_plot)])
|
||||||
|
Loading…
Reference in New Issue
Block a user