Closed sathishmanivannan closed 6 years ago
check this issue : https://github.com/bendidi/Tracking-with-darkflow/issues/9
I tried both the ways mentioned in Issue #9 but it still not working when i am trying to run for multiple videos. After here is my run.py and error .Please help in solving the issue. Where should I include tf.reset_default_graph()?
Run.py from darkflow.darkflow.defaults import argHandler #Import the default arguments import os from darkflow.darkflow.net.build import TFNet
topdir = 'D:\Videos' FLAGS = argHandler() FLAGS.setDefaults()
for root, dirs, files in os.walk(topdir, topdown=False): for name in files:
FLAGS.demo = "D:\\Videos"+name# video file to use, or if camera just put "camera"
FLAGS.model = "darkflow/cfg/yolo.cfg" # tensorflow model
FLAGS.load = "darkflow/bin/yolo.weights" # tensorflow weights
FLAGS.threshold = 0.5 # threshold of decetion confidance (detection if confidance > threshold )
FLAGS.gpu = 0.75 #how much of the GPU to use (between 0 and 1) 0 means use cpu
FLAGS.track = True # wheither to activate tracking or not
FLAGS.trackObj = "person" # the object to be tracked
FLAGS.saveVideo = True #whether to save the video or not
FLAGS.BK_MOG = False # activate background substraction using cv2 MOG substraction,
#to help in worst case scenarion when YOLO cannor predict(able to detect mouvement, it's not ideal but well)
# helps only when number of detection < 5, as it is still better than no detection.
FLAGS.tracker = "deep_sort" # wich algorithm to use for tracking deep_sort/sort (NOTE : deep_sort only trained for people detection )
FLAGS.skip = 3# how many frames to skipp between each detection to speed up the network
FLAGS.csv = True #whether to write csv file or not(only when tracking is set to True)
FLAGS.display = True # display the tracking or not
tfnet = TFNet(FLAGS)
tfnet.camera()
exit('Demo stopped, exit.')
Error :
Traceback (most recent call last):
File "C:\Users\13067_000\Tracking-with-darkflow\run.py", line 30, in
File "C:\Python35\lib\site-packages\tensorflow\python\framework\ops.py", line 1470, in init self._traceback = self._graph._extract_stack() # pylint: disable=protected-access File "C:\Python35\lib\site-packages\tensorflow\python\framework\ops.py", line 2956, in create_op op_def=op_def) File "C:\Python35\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 787, in _apply_op_helper op_def=op_def)
Run.py
from darkflow.darkflow.defaults import argHandler #Import the default arguments import os from darkflow.darkflow.net.build import TFNet
import tensorflow as tf
topdir = 'C:\Users\13067_000\Downloads\Videos' FLAGS = argHandler() FLAGS.setDefaults()
for dirpath, dirnames, files in os.walk(topdir): for name in files:
tf.reset_default_graph()
exit('Demo stopped, exit.')
Error: ValueError: Variable conv1_1/weights already exists, disallowed. Did you mean to set reuse=True or reuse=tf.AUTO_REUSE in VarScope? Originally defined at:
File "C:\Python35\lib\site-packages\tensorflow\python\framework\ops.py", line 1470, in init self._traceback = self._graph._extract_stack() # pylint: disable=protected-access File "C:\Python35\lib\site-packages\tensorflow\python\framework\ops.py", line 2956, in create_op op_def=op_def) File "C:\Python35\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 787, in _apply_op_helper op_def=op_def)
Please help me in running darkflow for multiple videos