Open ander2000 opened 3 years ago
Okay, you have a problem with the Code you are running. But to give you a meaningful answer I need the code you were running when the error happened. So if you could send it and put it in "```, ````" that would be the best to read bc the way you have written the question nobody can understand what the problem is and what the actual error output was. So if you provide the mentioned information I will be pleased to help you.
Best Wishes @ekesdf
Hello, sorry for the inconvenience. At the time of training, I receive the following: "WARNING: tensorflow: You built the loaded model, but the compiled metrics have not yet been compiled. Model.compile_metric will be empty until you train or evaluate the model".
Also, in mAP evaluation it shows me the following: "Evaluation samples: 59 Using IoU: 0.5 Using Object Threshold: 0.3 Using No Maximum Suppression: 0.5 hololents: 0.0000 mAP: 0.0000 [{'model_file': '/content/drive/MyDrive/hololens/models/detection_model-ex-001--loss-0037.935.h5', 'using_iou': 0.5, 'using_object_threshold': 0.3, 'using_non_maximum_suppression': 0.5, 'average_precision': {'hololens': 0.0}, 'Evaluation_samples': 59, 'map': 0.0}] ".
This is the training code:
from imageai.Detection.Custom import DetectionModelTrainer
trainer = DetectionModelTrainer ()
trainer.setModelTypeAsYOLOv3 ()
trainer.setDataDirectory (data_directory = "/content/drive/MyDrive/hololens")
trainer.setTrainConfig (object_names_array = ["hololens"], batch_size = 4, num_experiments = 2, train_from_pretrained_model = "/content/drive/MyDrive/matriculas/pretrained-yolov3.h5")
trainer.trainModel ()
This is the code for the model evaluation:
from imageai.Detection.Custom import DetectionModelTrainer
trainer = DetectionModelTrainer()
trainer.setModelTypeAsYOLOv3()
trainer.setDataDirectory(data_directory="/content/drive/MyDrive/hololens")
metrics = trainer.evaluateModel(model_path="/content/drive/MyDrive/hololens/models", json_path="/content/drive/MyDrive/hololens/json/detection_config.json", iou_threshold=0.5, object_threshold=0.3, nms_threshold=0.5)
print(metrics)
I am programming on the Google Colab platform
No problem no body is perfect.
@ekesdf The spaces were generated by mistake at the time of pasting the code, because both in Google Colab have the paths without spaces
Link to a Notebook that works for your training, just run it. You used the default dataset from the imageai documentations right. Then you can just run it, and it will train on that dataset
Well @ekesdf Thank you very much for your kindness, I will do the test. Anything, I keep you posted
@ekesdf Please accept my access request. email: "andermillanlopez@gmail.com"
I change the access level, so you should be able to edit it
Great thank you very much
Np keep it up and don't let you stop by some bug, there is always a solution even if it's not right around the corner. The is one, and you will find it, so good luck and have fun with your future projects
@ekesdf Thank you very much for your good wishes and good luck. I have loved working with "imageAI",
Why loved ?? You hate it now ??
@ekesdf I love working with "imageAI"
:smile: :partying_face:
@ekesdf The following has appeared to me:
"Evaluation samples: 59 Using IoU: 0.5 Using Object Threshold: 0.3 Using Non-Maximum Suppression: 0.5 hololens: 0.0747 mAP: 0.0747
[{'model_file': '/content/hololens/models/detection_model-ex-002--loss-0034.959.h5', 'using_iou': 0.5, 'using_object_threshold': 0.3, 'using_non_maximum_suppression': 0.5, 'average_precision': {'hololens': 0.07473810459116413}, 'evaluation_samples': 59, 'map': 0.07473810459116413}]"
It's right?
Yeah looks good your accuracy is just 7% but this is due to the little amount of training. The rest looks fine 👍
@ekesdf How could you improve accuracy?
Way longer training with much more data
@ekesdf Thank you very much and you are very kind. You helped me a lot
@ekesdf Thank you very much and you are very kind. You helped me a lot
You too mate have a great day
@ander2000 I am facing the same issues. How did you overcome the error?
@epistimi4 check out this Notebook, there is the right code he is using. If you have a problem, let me know.
Here is a potential workaround if you are getting an mAP of 0.0 at the evaluation step (and have verified the h5 model and the training/evaluation data is not corrupted):
During the evaluation step, ImageAI will recreate this folder along with the .pkl files. Between model training and evaluation, sometimes the file becomes "corrupted", which will give a default mAP of 0.0. Flushing the cache after training resolved this issue every time it occurred for me.
@ekesdf Please accept my access request. email: "andermillanlopez@gmail.com"
You should delete your email address from public view
Hello, at the time of training, I get the following: WARNING: tensorflow: Compiled the loaded model, but the compiled metrics have yet to be built.
model.compile_metrics
will be empty until you train or evaluate the model.And also in the mAP evaluation it shows me the following: Evaluation samples: 59 Using IoU: 0.5 Using Object Threshold: 0.3 Using Non-Maximum Suppression: 0.5 hololens: 0.0000 mAP: 0.0000
[{'model_file': '/content/drive/MyDrive/hololens/models/detection_model-ex-001--loss-0037.935.h5', 'using_iou': 0.5, 'using_object_threshold': 0.3, 'using_non_maximum_suppression': 0.5, 'average_precision': {'hololens': 0.0}, 'evaluation_samples': 59, 'map': 0.0}]