xuannianz / EfficientDet

EfficientDet (Scalable and Efficient Object Detection) implementation in Keras and Tensorflow
Apache License 2.0
1.4k stars 395 forks source link

a possibal solution for the model does NOT detect anything #276

Closed terrance-liang closed 3 weeks ago

terrance-liang commented 3 weeks ago

python == 3.7 tensowflow == 1.15.0

When I tried to use this combination to run the model inference, I first crashed at the gap between python2 and python3:

File "inference.py", line 30, in main model.load_weights(model_path, by_name=True) File "/home/compass/miniconda3/envs/efficientdet_new/lib/python3.7/site-packages/tensorflow_core/python/keras/engine/training.py", line 182, in load_weights return super(Model, self).load_weights(filepath, by_name) File "/home/compass/miniconda3/envs/efficientdet_new/lib/python3.7/site-packages/tensorflow_core/python/keras/engine/network.py", line 1371, in load_weights saving.load_weights_from_hdf5_group_by_name(f, self.layers) File "/home/compass/miniconda3/envs/efficientdet_new/lib/python3.7/site-packages/tensorflow_core/python/keras/saving/hdf5_format.py", line 712, in load_weights_from_hdf5_group_by_name original_keras_version = f.attrs['keras_version'] AttributeError: 'str' object has no attribute 'decode'

Then I removed ALL the .decode('utf8') in this file: /home/compass/miniconda3/envs/efficientdet_new/lib/python3.7/site-packages/tensorflow_core/python/keras/saving/hdf5_format.py. The model inference was done with nothing output (the boxes and labels are empty, and the scores are all -1).

The problem is that this file has 6 decodes, and only the first 4 are for string decodes. The last 2 are for weight loading, which can NOT be removed.

If anyone happens to have no detection output, hope this issue can help. Good luck coding.