Rename image.bin -> image-idx3-ubyte

This commit is contained in:
augustin64 2022-04-25 20:11:02 +02:00
parent 6652488b44
commit 4195dc91da

View File

@ -34,14 +34,14 @@ def post_json_handler():
def recognize_mnist(image): def recognize_mnist(image):
"""Appelle le programme C reconnaissant les images""" """Appelle le programme C reconnaissant les images"""
# Créer le fichier binaire # Créer le fichier binaire
write_image_to_binary(image, ".cache/image.bin") write_image_to_binary(image, ".cache/image-idx3-ubyte")
try: try:
output = subprocess.check_output([ output = subprocess.check_output([
'out/main', 'out/main',
'recognize', 'recognize',
'--modele', '.cache/reseau.bin', '--modele', '.cache/reseau.bin',
'--in', '.cache/image.bin', '--in', '.cache/image-idx3-ubyte',
'--out', 'json' '--out', 'json'
]).decode("utf-8") ]).decode("utf-8")
json_data = json.loads(output.replace("nan", "0.0"))["0"] json_data = json.loads(output.replace("nan", "0.0"))["0"]