Skip to content
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

object_detection_tutorial.ipynb detection error #1581

Closed
jwnsu opened this issue Jun 16, 2017 · 9 comments
Closed

object_detection_tutorial.ipynb detection error #1581

jwnsu opened this issue Jun 16, 2017 · 9 comments

Comments

@jwnsu
Copy link

jwnsu commented Jun 16, 2017

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 jwnsu changed the title object_detection_tutorial.ipynb error object_detection_tutorial.ipynb detection error Jun 16, 2017
@derekjchow
Copy link
Contributor

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?

@jwnsu
Copy link
Author

jwnsu commented Jun 16, 2017

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

much thanks!!

@DrChungAlbert
Copy link

DrChungAlbert commented Jun 28, 2017

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.

@derekjchow
Copy link
Contributor

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

@jtn-ms
Copy link

jtn-ms commented Jul 31, 2017

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?

@hardik124
Copy link

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

@DrChungAlbert
Copy link

DrChungAlbert commented Oct 11, 2017

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

@Swaarup
Copy link

Swaarup commented Aug 3, 2018

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.

@ElizaNami
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants