New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ObjectDetection exception: int() argument must be a string, a bytes-like object or a number, not 'NoneType' #35
Comments
Hello, did you ensure you downloaded the correct model file, set the correct model type and set the correct model path to the model file you downloaded? Ensure all of this is done before running your python code. |
This is python code, resnet50_coco_best_v2.0.1.h5 model file in models folder from imageai.Detection import ObjectDetection execution_path = os.getcwd() detector = ObjectDetection() detector.setModelPath(model_path) img_path = os.path.join(execution_path, "image\5.jpg") detector.loadModel() detections = detector.detectObjectsFromImage(input_image=img_path, for eachObject in detections: |
Please see discussion here #30 |
ok,thanks |
i got this type of error anyone knows how to solve please tell me i searching about it's solution lasst 3 days , i applied all things but it didn't solved TypeError Traceback (most recent call last) 2 frames TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType' |
C:\Users\admin\Anaconda3\python.exe D:/tensorflow/pyimages/detect.py
C:\Users\admin\Anaconda3\lib\site-packages\h5py_init_.py:34: FutureWarning: Conversion of the second argument of issubdtype from
float
tonp.floating
is deprecated. In future, it will be treated asnp.float64 == np.dtype(float).type
.from ._conv import register_converters as register_converters
Using TensorFlow backend.
Traceback (most recent call last):
File "D:/tensorflow/pyimages/day2-object-detect/detect.py", line 9, in
detector.loadModel(detection_speed="fast")
File "C:\Users\admin\Anaconda3\lib\site-packages\imageai\Detection_init.py", line 121, in loadModel
model = resnet50_retinanet(num_classes=80)
File "C:\Users\admin\Anaconda3\lib\site-packages\imageai\Detection\keras_retinanet\models\resnet.py", line 86, in resnet50_retinanet
return resnet_retinanet(num_classes=num_classes, backbone='resnet50', inputs=inputs, **kwargs)
File "C:\Users\admin\Anaconda3\lib\site-packages\imageai\Detection\keras_retinanet\models\resnet.py", line 80, in resnet_retinanet
model = retinanet.retinanet_bbox(inputs=inputs, num_classes=num_classes, backbone=resnet, **kwargs)
File "C:\Users\admin\Anaconda3\lib\site-packages\imageai\Detection\keras_retinanet\models\retinanet.py", line 347, in retinanet_bbox
model = retinanet(inputs=inputs, num_classes=num_classes, **kwargs)
File "C:\Users\admin\Anaconda3\lib\site-packages\imageai\Detection\keras_retinanet\models\retinanet.py", line 302, in retinanet
submodels = default_submodels(num_classes, anchor_parameters)
File "C:\Users\admin\Anaconda3\lib\site-packages\imageai\Detection\keras_retinanet\models\retinanet.py", line 210, in default_submodels
('regression', default_regression_model(anchor_parameters.num_anchors())),
File "C:\Users\admin\Anaconda3\lib\site-packages\imageai\Detection\keras_retinanet\models\retinanet.py", line 125, in default_regression_model
outputs = keras.layers.Reshape((-1, 4), name='pyramid_regression_reshape')(outputs)
File "C:\Users\admin\Anaconda3\lib\site-packages\keras\engine\topology.py", line 602, in call
output = self.call(inputs, **kwargs)
File "C:\Users\admin\Anaconda3\lib\site-packages\keras\layers\core.py", line 391, in call
target_shape = self.compute_output_shape(input_shape)[1:]
File "C:\Users\admin\Anaconda3\lib\site-packages\keras\layers\core.py", line 376, in compute_output_shape
input_shape[1:], self.target_shape)
File "C:\Users\admin\Anaconda3\lib\site-packages\keras\layers\core.py", line 364, in _fix_unknown_dimension
original = np.prod(input_shape, dtype=int)
File "C:\Users\admin\Anaconda3\lib\site-packages\numpy\core\fromnumeric.py", line 2566, in prod
out=out, **kwargs)
File "C:\Users\admin\Anaconda3\lib\site-packages\numpy\core_methods.py", line 35, in _prod
return umr_prod(a, axis, dtype, out, keepdims)
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'
I copy the ObjectDetection demo codes and run, but it throws this exception.
The text was updated successfully, but these errors were encountered: