models icon indicating copy to clipboard operation
models copied to clipboard

object_detection_tutorial.ipynb detection error

Open jwnsu opened this issue 9 years ago • 9 comments

Running tensor flow 1.0 CPU version on Ubuntu 16.04.

Checkout latest models (which fixed a previous test_ckpt download issue). Got following error at end of detection (bear with me the long cut-and-paste):


InvalidArgumentError Traceback (most recent call last) in () 19 (boxes, scores, classes, num_detections) = sess.run( 20 [boxes, scores, classes, num_detections], ---> 21 feed_dict={image_tensor: image_np_expanded}) 22 # Visualization of the results of a detection. 23 vis_util.visualize_boxes_and_labels_on_image_array(

/home/dsu/tf/local/lib/python2.7/site-packages/tensorflow/python/client/session.pyc in run(self, fetches, feed_dict, options, run_metadata) 765 try: 766 result = self._run(None, fetches, feed_dict, options_ptr, --> 767 run_metadata_ptr) 768 if run_metadata: 769 proto_data = tf_session.TF_GetBuffer(run_metadata_ptr)

/home/dsu/tf/local/lib/python2.7/site-packages/tensorflow/python/client/session.pyc in _run(self, handle, fetches, feed_dict, options, run_metadata) 963 if final_fetches or final_targets: 964 results = self._do_run(handle, final_targets, final_fetches, --> 965 feed_dict_string, options, run_metadata) 966 else: 967 results = []

/home/dsu/tf/local/lib/python2.7/site-packages/tensorflow/python/client/session.pyc in _do_run(self, handle, target_list, fetch_list, feed_dict, options, run_metadata) 1013 if handle is None: 1014 return self._do_call(_run_fn, self._session, feed_dict, fetch_list, -> 1015 target_list, options, run_metadata) 1016 else: 1017 return self._do_call(_prun_fn, self._session, handle, feed_dict,

/home/dsu/tf/local/lib/python2.7/site-packages/tensorflow/python/client/session.pyc in _do_call(self, fn, *args) 1033 except KeyError: 1034 pass -> 1035 raise type(e)(node_def, op, message) 1036 1037 def _extend_graph(self):

InvalidArgumentError: NodeDef mentions attr 'data_format' not in Op<name=DepthwiseConv2dNative; signature=input:T, filter:T -> output:T; attr=T:type,allowed=[DT_FLOAT, DT_DOUBLE]; attr=strides:list(int); attr=padding:string,allowed=["SAME", "VALID"]>; NodeDef: FeatureExtractor/MobilenetV1/MobilenetV1/Conv2d_1_depthwise/depthwise = DepthwiseConv2dNative[T=DT_FLOAT, data_format="NHWC", padding="SAME", strides=[1, 1, 1, 1], _device="/job:localhost/replica:0/task:0/cpu:0"](FeatureExtractor/MobilenetV1/MobilenetV1/Conv2d_0/Relu6, FeatureExtractor/MobilenetV1/Conv2d_1_depthwise/depthwise_weights/read) [[Node: FeatureExtractor/MobilenetV1/MobilenetV1/Conv2d_1_depthwise/depthwise = DepthwiseConv2dNative[T=DT_FLOAT, data_format="NHWC", padding="SAME", strides=[1, 1, 1, 1], _device="/job:localhost/replica:0/task:0/cpu:0"](FeatureExtractor/MobilenetV1/MobilenetV1/Conv2d_0/Relu6, FeatureExtractor/MobilenetV1/Conv2d_1_depthwise/depthwise_weights/read)]]

Caused by op u'FeatureExtractor/MobilenetV1/MobilenetV1/Conv2d_1_depthwise/depthwise', defined at: File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main "main", fname, loader, pkg_name) File "/usr/lib/python2.7/runpy.py", line 72, in _run_code exec code in run_globals File "/usr/local/lib/python2.7/dist-packages/ipykernel/main.py", line 3, in app.launch_new_instance() File "/home/dsu/.local/lib/python2.7/site-packages/traitlets/config/application.py", line 658, in launch_instance app.start() File "/usr/local/lib/python2.7/dist-packages/ipykernel/kernelapp.py", line 474, in start ioloop.IOLoop.instance().start() File "/usr/lib/python2.7/dist-packages/zmq/eventloop/ioloop.py", line 162, in start super(ZMQIOLoop, self).start() File "/usr/lib/python2.7/dist-packages/tornado/ioloop.py", line 866, in start handler_func(fd_obj, events) File "/usr/lib/python2.7/dist-packages/tornado/stack_context.py", line 275, in null_wrapper return fn(*args, **kwargs) File "/usr/lib/python2.7/dist-packages/zmq/eventloop/zmqstream.py", line 440, in _handle_events self._handle_recv() File "/usr/lib/python2.7/dist-packages/zmq/eventloop/zmqstream.py", line 472, in _handle_recv self._run_callback(callback, msg) File "/usr/lib/python2.7/dist-packages/zmq/eventloop/zmqstream.py", line 414, in _run_callback callback(*args, **kwargs) File "/usr/lib/python2.7/dist-packages/tornado/stack_context.py", line 275, in null_wrapper return fn(*args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/ipykernel/kernelbase.py", line 276, in dispatcher return self.dispatch_shell(stream, msg) File "/usr/local/lib/python2.7/dist-packages/ipykernel/kernelbase.py", line 228, in dispatch_shell handler(stream, idents, msg) File "/usr/local/lib/python2.7/dist-packages/ipykernel/kernelbase.py", line 390, in execute_request user_expressions, allow_stdin) File "/usr/local/lib/python2.7/dist-packages/ipykernel/ipkernel.py", line 196, in do_execute res = shell.run_cell(code, store_history=store_history, silent=silent) File "/usr/local/lib/python2.7/dist-packages/ipykernel/zmqshell.py", line 501, in run_cell return super(ZMQInteractiveShell, self).run_cell(*args, **kwargs) File "/home/dsu/.local/lib/python2.7/site-packages/IPython/core/interactiveshell.py", line 2717, in run_cell interactivity=interactivity, compiler=compiler, result=result) File "/home/dsu/.local/lib/python2.7/site-packages/IPython/core/interactiveshell.py", line 2821, in run_ast_nodes if self.run_code(code, result): File "/home/dsu/.local/lib/python2.7/site-packages/IPython/core/interactiveshell.py", line 2881, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "", line 7, in tf.import_graph_def(od_graph_def, name='') File "/home/dsu/tf/local/lib/python2.7/site-packages/tensorflow/python/framework/importer.py", line 287, in import_graph_def op_def=op_def) File "/home/dsu/tf/local/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 2395, in create_op original_op=self._default_original_op, op_def=op_def) File "/home/dsu/tf/local/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 1264, in init self._traceback = _extract_stack()

InvalidArgumentError (see above for traceback): NodeDef mentions attr 'data_format' not in Op<name=DepthwiseConv2dNative; signature=input:T, filter:T -> output:T; attr=T:type,allowed=[DT_FLOAT, DT_DOUBLE]; attr=strides:list(int); attr=padding:string,allowed=["SAME", "VALID"]>; NodeDef: FeatureExtractor/MobilenetV1/MobilenetV1/Conv2d_1_depthwise/depthwise = DepthwiseConv2dNative[T=DT_FLOAT, data_format="NHWC", padding="SAME", strides=[1, 1, 1, 1], _device="/job:localhost/replica:0/task:0/cpu:0"](FeatureExtractor/MobilenetV1/MobilenetV1/Conv2d_0/Relu6, FeatureExtractor/MobilenetV1/Conv2d_1_depthwise/depthwise_weights/read) [[Node: FeatureExtractor/MobilenetV1/MobilenetV1/Conv2d_1_depthwise/depthwise = DepthwiseConv2dNative[T=DT_FLOAT, data_format="NHWC", padding="SAME", strides=[1, 1, 1, 1], _device="/job:localhost/replica:0/task:0/cpu:0"](FeatureExtractor/MobilenetV1/MobilenetV1/Conv2d_0/Relu6, FeatureExtractor/MobilenetV1/Conv2d_1_depthwise/depthwise_weights/read)]

jwnsu avatar Jun 16 '17 19:06 jwnsu

It seems that the data_format attribute for the operation was added in Tensorflow v1.1. Could you install a new version of Tensorflow (v 1.1 or above) to see if it resolves your issue?

derekjchow avatar Jun 16 '17 20:06 derekjchow

After upgrade to tensorflow 1.2, it now works fine. Closing the issue.

much thanks!!

jwnsu avatar Jun 16 '17 20:06 jwnsu

In Ubuntu 14.04 ,after upgrade to tensorflow 1.2, still the same problem. Need I try to install Ubuntu 16.04?

Update: It's my python notebook env. wrong setting ; In Ubuntu 14.04 ,after upgrade to tensorflow 1.2 , it now works fine.

DrChungAlbert avatar Jun 28 '17 15:06 DrChungAlbert

@DrChungAlbert try Ubuntu 16.04. If it still fails, could you copy the error output?

derekjchow avatar Jun 28 '17 20:06 derekjchow

when I run the python file with spyder, encountered the following errors. ////////////////////////////////////////////////////////////////////// IPython 6.1.0 -- An enhanced Interactive Python.

runfile('E:/Projects/Tensorflow/example/object_detection/detectobject.py', wdir='E:/Projects/Tensorflow/example/object_detection') Traceback (most recent call last):

File "", line 1, in runfile('E:/Projects/Tensorflow/example/object_detection/detectobject.py', wdir='E:/Projects/Tensorflow/example/object_detection')

File "C:\Program Files\Anaconda3\envs\tensorflow\lib\site-packages\spyder\utils\site\sitecustomize.py", line 688, in runfile execfile(filename, namespace)

File "C:\Program Files\Anaconda3\envs\tensorflow\lib\site-packages\spyder\utils\site\sitecustomize.py", line 101, in execfile exec(compile(f.read(), filename, 'exec'), namespace)

File "E:/Projects/Tensorflow/example/object_detection/detectobject.py", line 106, in feed_dict={image_tensor: image_np_expanded}) NameError: name 'image_np_expanded' is not defined ///////////////////////////////////////////////////////////////// what is the problem? Can anyone help me?

jtn-ms avatar Jul 31 '17 08:07 jtn-ms

@DrChungAlbert What was the error, Even I am not able to get it to work on tf version 1.2

hardik124 avatar Oct 10 '17 00:10 hardik124

@hardik124 In Ubuntu 14.04, it's my python notebook env. wrong setting to tf 1.0, the error same as jwnsu's.

DrChungAlbert avatar Oct 11 '17 02:10 DrChungAlbert

If anyone still has a problem then, I guess it's because you have downloaded the wrong model. http://download.tensorflow.org/models/object_detection/ssd_inception_v2_coco_2017_11_17.tar.gz I downloaded this model and it worked.

swaarup avatar Aug 03 '18 08:08 swaarup

TimeoutError Traceback (most recent call last) c:\users\innaeli\anaconda3\envs\tfp3.6\lib\urllib\request.py in open(self, fullurl, data) 1756 if data is None: -> 1757 return getattr(self, name)(url) 1758 else:

c:\users\innaeli\anaconda3\envs\tfp3.6\lib\urllib\request.py in open_http(self, url, data) 1935 """Use HTTP protocol.""" -> 1936 return self._open_generic_http(http.client.HTTPConnection, url, data) 1937

c:\users\innaeli\anaconda3\envs\tfp3.6\lib\urllib\request.py in _open_generic_http(self, connection_factory, url, data) 1915 else: -> 1916 http_conn.request("GET", selector, headers=headers) 1917

c:\users\innaeli\anaconda3\envs\tfp3.6\lib\http\client.py in request(self, method, url, body, headers, encode_chunked) 1238 """Send a complete request to the server.""" -> 1239 self._send_request(method, url, body, headers, encode_chunked) 1240

c:\users\innaeli\anaconda3\envs\tfp3.6\lib\http\client.py in _send_request(self, method, url, body, headers, encode_chunked) 1284 body = _encode(body, 'body') -> 1285 self.endheaders(body, encode_chunked=encode_chunked) 1286

c:\users\innaeli\anaconda3\envs\tfp3.6\lib\http\client.py in endheaders(self, message_body, encode_chunked) 1233 raise CannotSendHeader() -> 1234 self._send_output(message_body, encode_chunked=encode_chunked) 1235

c:\users\innaeli\anaconda3\envs\tfp3.6\lib\http\client.py in _send_output(self, message_body, encode_chunked) 1025 del self._buffer[:] -> 1026 self.send(msg) 1027

c:\users\innaeli\anaconda3\envs\tfp3.6\lib\http\client.py in send(self, data) 963 if self.auto_open: --> 964 self.connect() 965 else:

c:\users\innaeli\anaconda3\envs\tfp3.6\lib\http\client.py in connect(self) 935 self.sock = self._create_connection( --> 936 (self.host,self.port), self.timeout, self.source_address) 937 self.sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)

c:\users\innaeli\anaconda3\envs\tfp3.6\lib\socket.py in create_connection(address, timeout, source_address) 723 if err is not None: --> 724 raise err 725 else:

c:\users\innaeli\anaconda3\envs\tfp3.6\lib\socket.py in create_connection(address, timeout, source_address) 712 sock.bind(source_address) --> 713 sock.connect(sa) 714 # Break explicitly a reference cycle

TimeoutError: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond

During handling of the above exception, another exception occurred:

OSError Traceback (most recent call last) in 1 opener = urllib.request.URLopener() 2 time.sleep(5) ----> 3 opener.retrieve(DOWNLOAD_BASE + MODEL_FILE, MODEL_FILE) 4 tar_file = tarfile.open(MODEL_FILE) 5 for file in tar_file.getmembers():

c:\users\innaeli\anaconda3\envs\tfp3.6\lib\urllib\request.py in retrieve(self, url, filename, reporthook, data) 1789 except OSError as msg: 1790 pass -> 1791 fp = self.open(url, data) 1792 try: 1793 headers = fp.info()

c:\users\innaeli\anaconda3\envs\tfp3.6\lib\urllib\request.py in open(self, fullurl, data) 1761 raise 1762 except OSError as msg: -> 1763 raise OSError('socket error', msg).with_traceback(sys.exc_info()[2]) 1764 1765 def open_unknown(self, fullurl, data=None):

c:\users\innaeli\anaconda3\envs\tfp3.6\lib\urllib\request.py in open(self, fullurl, data) 1755 try: 1756 if data is None: -> 1757 return getattr(self, name)(url) 1758 else: 1759 return getattr(self, name)(url, data)

c:\users\innaeli\anaconda3\envs\tfp3.6\lib\urllib\request.py in open_http(self, url, data) 1934 def open_http(self, url, data=None): 1935 """Use HTTP protocol.""" -> 1936 return self._open_generic_http(http.client.HTTPConnection, url, data) 1937 1938 def http_error(self, url, fp, errcode, errmsg, headers, data=None):

c:\users\innaeli\anaconda3\envs\tfp3.6\lib\urllib\request.py in _open_generic_http(self, connection_factory, url, data) 1914 http_conn.request("POST", selector, data, headers) 1915 else: -> 1916 http_conn.request("GET", selector, headers=headers) 1917 1918 try:

c:\users\innaeli\anaconda3\envs\tfp3.6\lib\http\client.py in request(self, method, url, body, headers, encode_chunked) 1237 encode_chunked=False): 1238 """Send a complete request to the server.""" -> 1239 self._send_request(method, url, body, headers, encode_chunked) 1240 1241 def _send_request(self, method, url, body, headers, encode_chunked):

c:\users\innaeli\anaconda3\envs\tfp3.6\lib\http\client.py in _send_request(self, method, url, body, headers, encode_chunked) 1283 # default charset of iso-8859-1. 1284 body = _encode(body, 'body') -> 1285 self.endheaders(body, encode_chunked=encode_chunked) 1286 1287 def getresponse(self):

c:\users\innaeli\anaconda3\envs\tfp3.6\lib\http\client.py in endheaders(self, message_body, encode_chunked) 1232 else: 1233 raise CannotSendHeader() -> 1234 self._send_output(message_body, encode_chunked=encode_chunked) 1235 1236 def request(self, method, url, body=None, headers={}, *,

c:\users\innaeli\anaconda3\envs\tfp3.6\lib\http\client.py in _send_output(self, message_body, encode_chunked) 1024 msg = b"\r\n".join(self._buffer) 1025 del self._buffer[:] -> 1026 self.send(msg) 1027 1028 if message_body is not None:

c:\users\innaeli\anaconda3\envs\tfp3.6\lib\http\client.py in send(self, data) 962 if self.sock is None: 963 if self.auto_open: --> 964 self.connect() 965 else: 966 raise NotConnected()

c:\users\innaeli\anaconda3\envs\tfp3.6\lib\http\client.py in connect(self) 934 """Connect to the host and port specified in init.""" 935 self.sock = self._create_connection( --> 936 (self.host,self.port), self.timeout, self.source_address) 937 self.sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) 938

c:\users\innaeli\anaconda3\envs\tfp3.6\lib\socket.py in create_connection(address, timeout, source_address) 722 723 if err is not None: --> 724 raise err 725 else: 726 raise error("getaddrinfo returns an empty list")

c:\users\innaeli\anaconda3\envs\tfp3.6\lib\socket.py in create_connection(address, timeout, source_address) 711 if source_address: 712 sock.bind(source_address) --> 713 sock.connect(sa) 714 # Break explicitly a reference cycle 715 err = None

OSError: [Errno socket error] [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond I am getting the above error while compiling object_detection_tutorial.ipynb file.

Can anyone tell what could be causing this error? I am using windows 10, Anaconda3 and Tensorflow 1.12

ElizaNami avatar Nov 29 '18 06:11 ElizaNami