From beaf53c7e0afaf9327e2f72e87c590a56310e78d Mon Sep 17 00:00:00 2001 From: marcsello Date: Wed, 16 Sep 2020 19:44:20 +0200 Subject: [PATCH 1/3] Fixed incorrectly scanning directories --- cnn_classification_service/cnn_classifier.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cnn_classification_service/cnn_classifier.py b/cnn_classification_service/cnn_classifier.py index df8570b..9e4c194 100644 --- a/cnn_classification_service/cnn_classifier.py +++ b/cnn_classification_service/cnn_classifier.py @@ -39,9 +39,10 @@ class Classifier(object): librosa.display.specshow(librosa.power_to_db(spectogram, ref=numpy.max)) target_dir = tempfile.mkdtemp() + wav_basename = os.path.basename(wav_filename) # Change extension to jpg... mert 110% biztos vagyok benne hogy a keras nem bírná beolvasni máshogy - file_name = os.path.join(target_dir, "unknown", f"{wav_filename[:-4]}.jpg") + file_name = os.path.join(target_dir, "unknown", f"{wav_basename[:-4]}.jpg") matplotlib.pyplot.savefig(file_name, dpi=400, bbox_inches='tight', pad_inches=0) matplotlib.pyplot.close() From b85502cf62888708458621811b2dca61d022bfab Mon Sep 17 00:00:00 2001 From: marcsello Date: Wed, 16 Sep 2020 19:55:21 +0200 Subject: [PATCH 2/3] Fixed directory creation --- cnn_classification_service/cnn_classifier.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cnn_classification_service/cnn_classifier.py b/cnn_classification_service/cnn_classifier.py index 9e4c194..09a66e4 100644 --- a/cnn_classification_service/cnn_classifier.py +++ b/cnn_classification_service/cnn_classifier.py @@ -43,6 +43,7 @@ class Classifier(object): # Change extension to jpg... mert 110% biztos vagyok benne hogy a keras nem bírná beolvasni máshogy file_name = os.path.join(target_dir, "unknown", f"{wav_basename[:-4]}.jpg") + os.mkdir(os.path.join(target_dir, "unknown")) matplotlib.pyplot.savefig(file_name, dpi=400, bbox_inches='tight', pad_inches=0) matplotlib.pyplot.close() @@ -50,7 +51,7 @@ class Classifier(object): matplotlib.pyplot.close(fig) matplotlib.pyplot.close('all') - return target_dir, file_name + return target_dir, file_name # Az unknown nélkülivel kell visszatérni def _run_predictor(self, directory: str) -> list: predict_generator = self.datagen.flow_from_directory( From 2e436608879670e9efb0162f0b68ee7e9afbdd77 Mon Sep 17 00:00:00 2001 From: marcsello Date: Fri, 18 Sep 2020 00:47:05 +0200 Subject: [PATCH 3/3] Removed ellipsis --- cnn_classification_service/magic_doer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cnn_classification_service/magic_doer.py b/cnn_classification_service/magic_doer.py index 980c509..bd4b393 100644 --- a/cnn_classification_service/magic_doer.py +++ b/cnn_classification_service/magic_doer.py @@ -58,7 +58,7 @@ def run_everything(parameters: dict): response = { "tag": tag, "probability": 1.0 if results[0] == 'sturnus' else 0.0, - "model": ... + "model": "TODO" } logging.info(f"Classification done!")