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

How to train a TensorFlow Object Detection Classifier for multiple object detection on Windows
Apache License 2.0
2.92k stars 1.3k forks source link

error when runing Object_detection_image.py #234

Open hluler opened 5 years ago

hluler commented 5 years ago

get the error when running Object_detection_image.py

(py3) jakey@jakey:~/Downloads/models-master/research/object_detection$ python Object_detection_image.py 2019-02-13 17:29:49.107347: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA Traceback (most recent call last): File "Object_detection_image.py", line 98, in feed_dict={image_tensor: image_expanded}) File "/home/jakey/anaconda3/envs/py3/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 929, in run run_metadata_ptr) File "/home/jakey/anaconda3/envs/py3/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1121, in _run np_val = np.asarray(subfeed_val, dtype=subfeed_dtype) File "/home/jakey/anaconda3/envs/py3/lib/python3.5/site-packages/numpy/core/numeric.py", line 538, 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'

anybody know what's wrong with it?

leccyril commented 5 years ago

in faster_rcnn_inception_v2_pets.config do like this

train_config: { batch_size: 1 optimizer { momentum_optimizer: { learning_rate: { manual_step_learning_rate { initial_learning_rate: 0.0002

schedule {

       # step: 0
        #learning_rate: .0002
      #}
      schedule {
        step: 900000
        learning_rate: .00002
      }
      schedule {
        step: 1200000
        learning_rate: .000002
      }
    }
  }
  momentum_optimizer_value: 0.9
}
use_moving_average: false

}

or maybe in generate_tfrecord

def class_text_to_int(row_label): if row_label == 'nine': return 1 elif row_label == 'ten': return 2 elif row_label == 'jack': return 3 elif row_label == 'queen': return 4 elif row_label == 'king': return 5 elif row_label == 'ace': return 6 else: None

dmjimenezbravo commented 5 years ago

get the error when running Object_detection_image.py

(py3) jakey@jakey:~/Downloads/models-master/research/object_detection$ python Object_detection_image.py 2019-02-13 17:29:49.107347: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA Traceback (most recent call last): File "Object_detection_image.py", line 98, in feed_dict={image_tensor: image_expanded}) File "/home/jakey/anaconda3/envs/py3/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 929, in run run_metadata_ptr) File "/home/jakey/anaconda3/envs/py3/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1121, in _run np_val = np.asarray(subfeed_val, dtype=subfeed_dtype) File "/home/jakey/anaconda3/envs/py3/lib/python3.5/site-packages/numpy/core/numeric.py", line 538, 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'

anybody know what's wrong with it?

Hi @longjie1986,

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

chefkoch10 commented 4 years ago

get the error when running Object_detection_image.py (py3) jakey@jakey:~/Downloads/models-master/research/object_detection$ python Object_detection_image.py 2019-02-13 17:29:49.107347: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA Traceback (most recent call last): File "Object_detection_image.py", line 98, in feed_dict={image_tensor: image_expanded}) File "/home/jakey/anaconda3/envs/py3/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 929, in run run_metadata_ptr) File "/home/jakey/anaconda3/envs/py3/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1121, in _run np_val = np.asarray(subfeed_val, dtype=subfeed_dtype) File "/home/jakey/anaconda3/envs/py3/lib/python3.5/site-packages/numpy/core/numeric.py", line 538, 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' anybody know what's wrong with it?

Hi @longjie1986,

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

Worked for me, thanks!

AnujLahoty commented 4 years ago

@diegomjb94 Thank you so much for providing the solution of the above problem.I was stuck since 2 days.Thanks man!

DynamicCodes commented 4 years ago

get the error when running Object_detection_image.py (py3) jakey@jakey:~/Downloads/models-master/research/object_detection$ python Object_detection_image.py 2019-02-13 17:29:49.107347: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA Traceback (most recent call last): File "Object_detection_image.py", line 98, in feed_dict={image_tensor: image_expanded}) File "/home/jakey/anaconda3/envs/py3/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 929, in run run_metadata_ptr) File "/home/jakey/anaconda3/envs/py3/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1121, in _run np_val = np.asarray(subfeed_val, dtype=subfeed_dtype) File "/home/jakey/anaconda3/envs/py3/lib/python3.5/site-packages/numpy/core/numeric.py", line 538, 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' anybody know what's wrong with it?

Hi @longjie1986,

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

thanks, it works great!!!