generated from daniil-berg/boilerplate-py
Reduce tensorflow verbosity
This commit is contained in:
parent
a8636822c9
commit
b7894787ca
@ -1,6 +1,6 @@
|
|||||||
[metadata]
|
[metadata]
|
||||||
name = ccaptchas
|
name = ccaptchas
|
||||||
version = 0.1.1
|
version = 0.1.2
|
||||||
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
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
import os
|
||||||
|
import warnings
|
||||||
from argparse import ArgumentParser
|
from argparse import ArgumentParser
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any, Sequence
|
from typing import Any, Sequence
|
||||||
@ -156,4 +158,8 @@ def main() -> None:
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
# Shut up Tensorflow:
|
||||||
|
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
|
||||||
|
# Shut up numpy:
|
||||||
|
warnings.filterwarnings('ignore', 'elementwise comparison failed', FutureWarning, module='numpy')
|
||||||
main()
|
main()
|
||||||
|
@ -52,7 +52,7 @@ def load_inference_model(model_dir: PathT) -> tuple[Model, StringLookup]:
|
|||||||
|
|
||||||
def predict_and_decode(images: Sequence[ImgT], model: Model, backward_lookup: StringLookup) -> tuple[Array, list[str]]:
|
def predict_and_decode(images: Sequence[ImgT], model: Model, backward_lookup: StringLookup) -> tuple[Array, list[str]]:
|
||||||
dataset = np.array([process_image(img) for img in images])
|
dataset = np.array([process_image(img) for img in images])
|
||||||
encoded_labels = process_predictions(model.predict(dataset))
|
encoded_labels = process_predictions(model.predict(dataset, verbose=0))
|
||||||
return dataset, [decode_label(label, backward_lookup) for label in encoded_labels]
|
return dataset, [decode_label(label, backward_lookup) for label in encoded_labels]
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user