Merge branch 'master' of ssh://cloud.tormakristof.eu:2222/birbnetes/cnn-classification-service
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Pünkösd Marcell 2020-10-01 16:14:22 +02:00
commit 4d7847d58e
2 changed files with 5 additions and 3 deletions

View File

@ -39,9 +39,11 @@ class Classifier(object):
librosa.display.specshow(librosa.power_to_db(spectogram, ref=numpy.max)) librosa.display.specshow(librosa.power_to_db(spectogram, ref=numpy.max))
target_dir = tempfile.mkdtemp() 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 # 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")
os.mkdir(os.path.join(target_dir, "unknown"))
matplotlib.pyplot.savefig(file_name, dpi=400, bbox_inches='tight', pad_inches=0) matplotlib.pyplot.savefig(file_name, dpi=400, bbox_inches='tight', pad_inches=0)
matplotlib.pyplot.close() matplotlib.pyplot.close()
@ -49,7 +51,7 @@ class Classifier(object):
matplotlib.pyplot.close(fig) matplotlib.pyplot.close(fig)
matplotlib.pyplot.close('all') 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: def _run_predictor(self, directory: str) -> list:
predict_generator = self.datagen.flow_from_directory( predict_generator = self.datagen.flow_from_directory(

View File

@ -58,7 +58,7 @@ def run_everything(parameters: dict):
response = { response = {
"tag": tag, "tag": tag,
"probability": 1.0 if results[0] == 'sturnus' else 0.0, "probability": 1.0 if results[0] == 'sturnus' else 0.0,
"model": ... "model": "TODO"
} }
logging.info(f"Classification done!") logging.info(f"Classification done!")