Darkflow: issues with yolo on raspberry pi

Created on 21 Mar 2018  路  2Comments  路  Source: thtrieu/darkflow

Hello all, I have issues with Darkflow on the Raspberry Pi 2 model b+ running Raspbian Stretch OS. All dependencies are installed (tensorflow 1.3.1,numpy,opencv 3.4.0). the error is after running the command :
./flow --imgdir sample_img --model cfg/tiny-yolo-voc.cfg --load tiny-yolo-voc.weights --threshold 0

the error message is :

```Traceback (most recent call last):
File "/home/pi/.virtualenvs/cv/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1327, in _do_call
return fn(*args)
File "/home/pi/.virtualenvs/cv/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1297, in _run_fn
self._extend_graph()
File "/home/pi/.virtualenvs/cv/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1358, in _extend_graph
self._session, graph_def.SerializeToString(), status)
File "/usr/lib/python3.5/contextlib.py", line 66, in __exit__
next(self.gen)
File "/home/pi/.virtualenvs/cv/lib/python3.5/site-packages/tensorflow/python/framework/errors_impl.py", line 466, in raise_exception_on_not_ok_status
pywrap_tensorflow.TF_GetCode(status))
tensorflow.python.framework.errors_impl.InvalidArgumentError: No OpKernel was registered to support Op 'Switch' with these attrs. Registered devices: [CPU], Registered kernels:
device='CPU'; T in [DT_FLOAT]
device='CPU'; T in [DT_INT32]
device='GPU'; T in [DT_STRING]
device='GPU'; T in [DT_BOOL]
device='GPU'; T in [DT_INT32]
device='GPU'; T in [DT_FLOAT]

 [[Node: 20-convolutional_3/cond/Switch = Switch[T=DT_BOOL](20-convolutional/is_training, 20-convolutional/is_training)]]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "./flow", line 6, in
cliHandler(sys.argv)
File "/home/pi/darkflow/darkflow/cli.py", line 26, in cliHandler
tfnet = TFNet(FLAGS)
File "/home/pi/darkflow/darkflow/net/build.py", line 76, in __init__
self.setup_meta_ops()
File "/home/pi/darkflow/darkflow/net/build.py", line 146, in setup_meta_ops
self.sess.run(tf.global_variables_initializer())
File "/home/pi/.virtualenvs/cv/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 895, in run
run_metadata_ptr)
File "/home/pi/.virtualenvs/cv/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1124, in _run
feed_dict_tensor, options, run_metadata)
File "/home/pi/.virtualenvs/cv/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1321, in _do_run
options, run_metadata)
File "/home/pi/.virtualenvs/cv/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1340, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.InvalidArgumentError: No OpKernel was registered to support Op 'Switch' with these attrs. Registered devices: [CPU], Registered kernels:
device='CPU'; T in [DT_FLOAT]
device='CPU'; T in [DT_INT32]
device='GPU'; T in [DT_STRING]
device='GPU'; T in [DT_BOOL]
device='GPU'; T in [DT_INT32]
device='GPU'; T in [DT_FLOAT]

 [[Node: 20-convolutional_3/cond/Switch = Switch[T=DT_BOOL](20-convolutional/is_training, 20-convolutional/is_training)]]

Caused by op '20-convolutional_3/cond/Switch', defined at:
File "./flow", line 6, in
cliHandler(sys.argv)
File "/home/pi/darkflow/darkflow/cli.py", line 26, in cliHandler
tfnet = TFNet(FLAGS)
File "/home/pi/darkflow/darkflow/net/build.py", line 75, in __init__
self.build_forward()
File "/home/pi/darkflow/darkflow/net/build.py", line 115, in build_forward
state = op_create(args)
File "/home/pi/darkflow/darkflow/net/ops/__init__.py", line 27, in op_create
return op_typeslayer_type
File "/home/pi/darkflow/darkflow/net/ops/baseop.py", line 42, in __init__
self.forward()
File "/home/pi/darkflow/darkflow/net/ops/convolution.py", line 73, in forward
temp = self.batchnorm(self.lay, temp)
File "/home/pi/darkflow/darkflow/net/ops/convolution.py", line 90, in batchnorm
return slim.batch_norm(inp, *
args)
File "/home/pi/.virtualenvs/cv/lib/python3.5/site-packages/tensorflow/contrib/framework/python/ops/arg_scope.py", line 181, in func_with_args
return func(args, *current_args)
File "/home/pi/.virtualenvs/cv/lib/python3.5/site-packages/tensorflow/contrib/layers/python/layers/layers.py", line 785, in batch_norm
moving_vars_fn)
File "/home/pi/.virtualenvs/cv/lib/python3.5/site-packages/tensorflow/contrib/layers/python/layers/utils.py", line 212, in smart_cond
return control_flow_ops.cond(pred, fn1, fn2, name)
File "/home/pi/.virtualenvs/cv/lib/python3.5/site-packages/tensorflow/python/util/deprecation.py", line 296, in new_func
return func(args, *kwargs)
File "/home/pi/.virtualenvs/cv/lib/python3.5/site-packages/tensorflow/python/ops/control_flow_ops.py", line 1808, in cond
p_2, p_1 = switch(pred, pred)
File "/home/pi/.virtualenvs/cv/lib/python3.5/site-packages/tensorflow/python/ops/control_flow_ops.py", line 302, in switch
return gen_control_flow_ops._switch(data, pred, name=name)
File "/home/pi/.virtualenvs/cv/lib/python3.5/site-packages/tensorflow/python/ops/gen_control_flow_ops.py", line 354, in _switch
result = _op_def_lib.apply_op("Switch", data=data, pred=pred, name=name)
File "/home/pi/.virtualenvs/cv/lib/python3.5/site-packages/tensorflow/python/framework/op_def_library.py", line 767, in apply_op
op_def=op_def)
File "/home/pi/.virtualenvs/cv/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 2630, in create_op
original_op=self._default_original_op, op_def=op_def)
File "/home/pi/.virtualenvs/cv/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 1204, in __init__
self._traceback = self._graph._extract_stack() # pylint: disable=protected-access

InvalidArgumentError (see above for traceback): No OpKernel was registered to support Op 'Switch' with these attrs. Registered devices: [CPU], Registered kernels:
device='CPU'; T in [DT_FLOAT]
device='CPU'; T in [DT_INT32]
device='GPU'; T in [DT_STRING]
device='GPU'; T in [DT_BOOL]
device='GPU'; T in [DT_INT32]
device='GPU'; T in [DT_FLOAT]

 [[Node: 20-convolutional_3/cond/Switch = Switch[T=DT_BOOL](20-convolutional/is_training, 20-convolutional/is_training)]]

```

Is this a hardware constraint?
I have no idea what's wrong and how to resolve this. Could you help?

Most helpful comment

I had the same issue on my Raspberry Pi 3 Model B running Raspbian Stretch.

The thing is that the latest TensorFlow versions don't go too well with the Raspberry ARM architecture and DarkFlow.

I fixed it by downloading TensorFlow 1.0.1 from samjabrahams' tensorflow-on-raspberry-pi repository, renaming it to tensorflow-1.0.1-cp35-none-linux_armv7l.whl (to be able to install it on a Python 3.5 environment) and installing it with sudo pip install tensorflow-1.0.1-cp35-none-linux_armv7l.whl.

Works like a charm.

If this works for you, close this issue so more people can see that it's possible to run DarkFlow on Raspberry Pi.

All 2 comments

I had the same issue on my Raspberry Pi 3 Model B running Raspbian Stretch.

The thing is that the latest TensorFlow versions don't go too well with the Raspberry ARM architecture and DarkFlow.

I fixed it by downloading TensorFlow 1.0.1 from samjabrahams' tensorflow-on-raspberry-pi repository, renaming it to tensorflow-1.0.1-cp35-none-linux_armv7l.whl (to be able to install it on a Python 3.5 environment) and installing it with sudo pip install tensorflow-1.0.1-cp35-none-linux_armv7l.whl.

Works like a charm.

If this works for you, close this issue so more people can see that it's possible to run DarkFlow on Raspberry Pi.

I kind of moved to another project, so i won't be able to test this out.
Still, thank you.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ma3252788 picture ma3252788  路  3Comments

wonny2001 picture wonny2001  路  4Comments

eugtanchik picture eugtanchik  路  4Comments

realityzero picture realityzero  路  3Comments

jubjamie picture jubjamie  路  4Comments