EdjeElectronics/TensorFlow-Object-Detection-API-Tutorial-Train-Multiple-Objects-Windows-10

TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'

Closed this issue · 23 comments

Traceback (most recent call last):
File "C:\tensorflow1\models\research\object_detection\Object_detection_image.py", line 98, in
feed_dict={image_tensor: image_expanded})
File "C:\Users\asus\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\client\session.py", line 900, in run
run_metadata_ptr)
File "C:\Users\asus\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\client\session.py", line 1104, in _run
np_val = np.asarray(subfeed_val, dtype=subfeed_dtype)
File "C:\Users\asus\Anaconda3\envs\tensorflow1\lib\site-packages\numpy\core\numeric.py", line 492, in asarray
return array(a, dtype, copy=False, order=order)
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'

Why I'm getting this????

In the last step when I'm trying to detect the windmill from the satellite image using the object detection using image python script

This is because you are you are using xml of different schema. Please check if your schema matches the one given in the repository and make the changes accordingly.

@thak123 not understandable, please be more clear

for me it was simply file input does'nt not exists

hello ,do you solve this problem?

hello, i have same problem, how to fix it?

i solve this problem. Modify line 34 "IMAGE_NAME = 'test1.jpg'" to IMAGE_NAME = 'test1.JPG'.

Hi every one,
i'm runing live stream video camera using RTSP protocol , it can run about 1 minute and than have a proplem that:
Traceback (most recent call last):
File "Vehicle_classifier_counting.py", line 198, in
feed_dict={image_tensor: frame_expanded})
File "C:\ProgramData\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\client\session.py", line 929, in run
run_metadata_ptr)
File "C:\ProgramData\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\client\session.py", line 1121, in _run
np_val = np.asarray(subfeed_val, dtype=subfeed_dtype)
File "C:\ProgramData\Anaconda3\envs\tensorflow1\lib\site-packages\numpy\core\numeric.py", line 501, in asarray
return array(a, dtype, copy=False, order=order)
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'

can any one have the same this proplem and fixed it, please help me!

Hi kaaier,
Thanks for your reply. I think the path information is correct because it can run about one minute and than it issue.

Hi, could you solve this?
I can run and correctly perform object detection but at the end of the video i get this error

In the last step when I'm trying to detect the windmill from the satellite image using the object detection using image python script

Hi @pariharatul,

According to the type of error, it seems that the image is of type None. This error could be possible because the image has not been loaded successfully in the "image_expanded" variable. How can be this possible if the path to the image is correct? I don't know. However, it seems that the "imread" function of the OpenCV library has some problems when trying to read an image with the absolute path but not with the relative path.

So, try to replace the line 92 with this code "image = cv2.imread('./' + IMAGE_NAME)", for example. With this solution, we provide the image relative path to the "imread" function instead of an absolute path like before.

I really hope this could fix your problem.

Greetings,
@diegomjb94

hello ,do you solve this problem?

I solve this problem. just replace "video = cv2.VideoCapture(0)" to "video = cv2.VideoCapture(1)",
if it is not work ,maybe you can try other numbers.

hktxt commented

hello ,do you solve this problem?

I solve this problem. just replace "video = cv2.VideoCapture(0)" to "video = cv2.VideoCapture(1)",
if it is not work ,maybe you can try other numbers.

sometimes it works, sometimes it doesn't.

Hi,
Error mainly occurs because of non existence of image file to be trained in cwd. Kindly use the current folder location of the test image file in cwd or simply put the test image in object detection folder as cwd

I solved this problem. Check the path will help.

I have used this for specific object detection of bottle
indices = np.argwhere(classes ==44)
if the class is given as 1 which for persons it is working fine but if I try for different classes. it is throwing an error.

TypeError Traceback (most recent call last)
in
22 (boxes, scores, classes, num_detections) = sess.run(
23 [boxes, scores, classes, num_detections],
---> 24 feed_dict={image_tensor: image_np_expanded})
25 # Visualization of the results of a detection.
26 boxes = np.squeeze(boxes)

TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'`

`

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)
in ()
83 (boxes, scores, classes, num) = sess.run(
84 [detection_boxes, detection_scores, detection_classes, num_detections],
---> 85 feed_dict={image_tensor: frame_expanded})
86
87 # Draw the results of the detection (aka 'visulaize the results')

2 frames
/usr/local/lib/python3.6/dist-packages/numpy/core/_asarray.py in asarray(a, dtype, order)
83
84 """
---> 85 return array(a, dtype, copy=False, order=order)
86
87

TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'

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)
in ()
83 (boxes, scores, classes, num) = sess.run(
84 [detection_boxes, detection_scores, detection_classes, num_detections],
---> 85 feed_dict={image_tensor: frame_expanded})
86
87 # Draw the results of the detection (aka 'visulaize the results')

2 frames
/usr/local/lib/python3.6/dist-packages/numpy/core/_asarray.py in asarray(a, dtype, order)
83
84 """
---> 85 return array(a, dtype, copy=False, order=order)
86
87

TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'

hello .. do you solve this?

TypeError Traceback (most recent call last)
in ()
96 (boxes, scores, classes, num) = sess.run(
97 [detection_boxes, detection_scores, detection_classes, num_detections],
---> 98 feed_dict={image_tensor: frame_expanded})
99
100 # Draw the results of the detection (aka 'visulaize the results')

2 frames
/usr/local/lib/python3.6/dist-packages/numpy/core/_asarray.py in asarray(a, dtype, order)
83
84 """
---> 85 return array(a, dtype, copy=False, order=order)
86
87

TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'