osrf/tensorflow_object_detector

raise RuntimeError('Attempted to use a closed Session.') RuntimeError: Attempted to use a closed Session.

Closed this issue ยท 2 comments

Hey guys,

Thanks for putting this together - it's rare to find ML & ROS tutorials. This is exactly what I needed ๐Ÿ‘
I am trying to run the usb_cam example: roslaunch tensorflow_object_detector usb_cam_detector.launch and it looks like the program runs fine until this line: (boxes, scores, classes, num_detections) = sess.run([boxes, scores, classes, num_detections], feed_dict={image_tensor: image_np_expanded})

The error below is what I get. It loops over in image_cb and prints the following error every time it gets to the line mentioned above:

[ERROR] [1539275044.021065]: bad callback: <bound method detector.image_cb of <__main__.detector instance at 0x7fc7073b5488>>
Traceback (most recent call last):
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/topics.py", line 750, in _invoke_callback
    cb(msg)
  File "/home/gal/Tensorflow_ws/src/tensorflow_object_detector/scripts/detect_ros.py", line 121, in image_cb
    feed_dict={image_tensor: image_np_expanded})
  File "/home/gal/tensorflow/local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 887, in run
    run_metadata_ptr)
  File "/home/gal/tensorflow/local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1033, in _run
    raise RuntimeError('Attempted to use a closed Session.')
RuntimeError: Attempted to use a closed Session.

Hi @GalMoore ,
I also faced this issue, see if this patch works for you.

Works fine now thanks!