Open AsyDynamics opened 6 years ago
Use another image from https://github.com/experiencor/raccoon_dataset to predict, and get one more different error:
ValueError: axes don't match array Exception ignored in: <bound method BaseSession.del of <tensorflow.python.client.session.Session object at 0x66121b50>> Traceback (most recent call last): File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py", line 707, in del TypeError: 'NoneType' object is not callable
update: it happen when using the pretrained mobilenet model to predict. It even keeps reporting error when using self trained mobilenet model.
Fork the keras-yolo2 and try to predict again, using mobilenet_backend.h5. It seems should use mobilenet_raccoon.h5 rather than the backend.h5.
_Traceback (most recent call last):
File "predict.py", line 96, in
update: it happen when using backend.h5 model rather than the trained model.
on laptop, ubuntu 16, try python3 gen_anchors.py
_AttributeError: 'NamespacePath' object has no attribute 'sort'
update: not happen anymore, should specify the configure file by appending -c config.json
Sometimes I got this error when running prediction:
/home/pi/keras-yolo2/utils.py:198: RuntimeWarning: overflow encountered in exp return 1. / (1. + np.exp(-x))
though it could find the object in image, but the bounding box could not be plotted. It seems happen when the object is full size (almost the same size as the image). So may be just the cv plotting error.
update: using the given trained model and self trained model, get different results when predicting the same image. sometimes got more than one box (different size) over one object. update it even happens when the bounding box is found and plotted as well updae :+1:
import bigfloat
, bigfloat.exp(number, bigfloat.precision(digits))
numpy.seterr
to control how to handle the errorHi @AsyDynamics I have the same error, RuntimeWarning: overflow encountered in exp return 1. / (1. + np.exp(-x)) Can you tell me how did you solve it?
The demo in original repo (https://github.com/experiencor/keras-yolo2) is in python2. I installed the necessary library of python3 and try to run prediction: python3 predict.py -c config.json -w mobilenet_raccoon.h5 -i images/dog.jpg
But get such error:
Total params: 3,259,614 Trainable params: 3,237,726 Non-trainable params: 21,888
Traceback (most recent call last): File "predict.py", line 96, in main(args) File "predict.py", line 56, in main yolo.load_weights(weights_path) File "/home/pi/CNN/keras-yolo2/frontend.py", line 243, in load_weights self.model.load_weights(weight_path) File "/usr/local/lib/python3.5/dist-packages/keras/engine/network.py", line 1180, in load_weights f, self.layers, reshape=reshape) File "/usr/local/lib/python3.5/dist-packages/keras/engine/saving.py", line 916, in load_weights_from_hdf5_group reshape=reshape) File "/usr/local/lib/python3.5/dist-packages/keras/engine/saving.py", line 557, in preprocess_weights_for_loading weights = convert_nested_model(weights) File "/usr/local/lib/python3.5/dist-packages/keras/engine/saving.py", line 545, in convert_nested_model original_backend=original_backend)) File "/usr/local/lib/python3.5/dist-packages/keras/engine/saving.py", line 557, in preprocess_weights_for_loading weights = convert_nested_model(weights) File "/usr/local/lib/python3.5/dist-packages/keras/engine/saving.py", line 533, in convert_nested_model original_backend=original_backend)) File "/usr/local/lib/python3.5/dist-packages/keras/engine/saving.py", line 675, in preprocess_weights_for_loading weights[0] = np.transpose(weights[0], (3, 2, 0, 1)) File "/usr/local/lib/python3.5/dist-packages/numpy/core/fromnumeric.py", line 575, in transpose return _wrapfunc(a, 'transpose', axes) File "/usr/local/lib/python3.5/dist-packages/numpy/core/fromnumeric.py", line 52, in _wrapfunc return getattr(obj, method)(*args, **kwds) ValueError: axes don't match array
The config json file is: { "model" : { "backend": "MobileNet", "input_size": 416, "anchors": [0.57273, 0.677385, 1.87446, 2.06253, 3.33843, 5.47434, 7.88282, 3.52778, 9.77052, 9.16828], "max_box_per_image": 10, "labels": ["raccoon"] },
"train": { "train_image_folder": "/home/andy/data/kangaroo/images/", "train_annot_folder": "/home/andy/data/kangaroo/annots/",
},
"valid": { "valid_image_folder": "", "valid_annot_folder": "",
} }
The error later appears when using the self trained mobilenet model to predict.