deep-diver / Soccer-Ball-Detection-YOLOv2

YOLOv2 trained against custom dataset
118 stars 43 forks source link

train error #4

Open SreenijaK opened 5 years ago

SreenijaK commented 5 years ago

when i run tfnet.train() i get the following error ValueError: Cannot feed value of shape (8, 608, 608, 3) for Tensor 'input:0', which has shape '(?, 608, 608, 1)'

deep-diver commented 5 years ago

Are you using your own custom dataset? Looks like the image you are using has only one channel which means black & white. If that is true, please make it to have 3 channels.

SreenijaK commented 5 years ago

Hi thank you . i changed the channels to one previously changing it back to 3 worked. I'm training with your data. Now i get the following error InvalidArgumentError: Input to reshape is a tensor with 1227400 values, but the requested shape requires a multiple of 10830 [[Node: Reshape = Reshape[T=DT_FLOAT, Tshape=DT_INT32, _device="/job:localhost/replica:0/task:0/device:CPU:0"](BiasAdd_22, Reshape/shape)]]

deep-diver commented 5 years ago

I am wondering where "reshape" is happening?

SreenijaK commented 5 years ago

F:/bp/computer_vision/yolo_train/data/yolo_custom.cfg parsing F:/bp/computer_vision/yolo_train/data/annotations/ Parsing for ['ball'] [====================>]100% scene21261.xml Statistics: ball: 177 Dataset size: 191 Dataset of 191 instance(s) Training statistics: Learning rate : 1e-05 Batch size : 8 Epoch number : 100 Backup every : 2000 Traceback (most recent call last):

File "", line 1, in runfile('F:/bp/computer_vision/yolo_train/train.py', wdir='F:/bp/computer_vision/yolo_train')

File "C:\Users\hi\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 705, in runfile execfile(filename, namespace)

File "C:\Users\hi\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 102, in execfile exec(compile(f.read(), filename, 'exec'), namespace)

File "F:/bp/computer_vision/yolo_train/train.py", line 26, in tfnet.train()

File "f:\bp\computer_vision\yolo_train\darkflow\darkflow\net\flow.py", line 56, in train fetched = self.sess.run(fetches, feed_dict)

File "C:\Users\hi\Anaconda3\lib\site-packages\tensorflow\python\client\session.py", line 877, in run run_metadata_ptr)

File "C:\Users\hi\Anaconda3\lib\site-packages\tensorflow\python\client\session.py", line 1100, in _run feed_dict_tensor, options, run_metadata)

File "C:\Users\hi\Anaconda3\lib\site-packages\tensorflow\python\client\session.py", line 1272, in _do_run run_metadata)

File "C:\Users\hi\Anaconda3\lib\site-packages\tensorflow\python\client\session.py", line 1291, in _do_call raise type(e)(node_def, op, message)

InvalidArgumentError: Input to reshape is a tensor with 1227400 values, but the requested shape requires a multiple of 10830 [[Node: Reshape = Reshape[T=DT_FLOAT, Tshape=DT_INT32, _device="/job:localhost/replica:0/task:0/device:CPU:0"](BiasAdd_22, Reshape/shape)]]

Caused by op 'Reshape', defined at: File "C:\Users\hi\Anaconda3\lib\site-packages\spyder\utils\ipython\start_kernel.py", line 269, in main() File "C:\Users\hi\Anaconda3\lib\site-packages\spyder\utils\ipython\start_kernel.py", line 265, in main kernel.start() File "C:\Users\hi\Anaconda3\lib\site-packages\ipykernel\kernelapp.py", line 486, in start self.io_loop.start() File "C:\Users\hi\Anaconda3\lib\site-packages\tornado\platform\asyncio.py", line 127, in start self.asyncio_loop.run_forever() File "C:\Users\hi\Anaconda3\lib\asyncio\base_events.py", line 422, in run_forever self._run_once() File "C:\Users\hi\Anaconda3\lib\asyncio\base_events.py", line 1432, in _run_once handle._run() File "C:\Users\hi\Anaconda3\lib\asyncio\events.py", line 145, in _run self._callback(self._args) File "C:\Users\hi\Anaconda3\lib\site-packages\tornado\platform\asyncio.py", line 117, in _handle_events handler_func(fileobj, events) File "C:\Users\hi\Anaconda3\lib\site-packages\tornado\stack_context.py", line 276, in null_wrapper return fn(args, kwargs) File "C:\Users\hi\Anaconda3\lib\site-packages\zmq\eventloop\zmqstream.py", line 450, in _handle_events self._handle_recv() File "C:\Users\hi\Anaconda3\lib\site-packages\zmq\eventloop\zmqstream.py", line 480, in _handle_recv self._run_callback(callback, msg) File "C:\Users\hi\Anaconda3\lib\site-packages\zmq\eventloop\zmqstream.py", line 432, in _run_callback callback(*args, *kwargs) File "C:\Users\hi\Anaconda3\lib\site-packages\tornado\stack_context.py", line 276, in null_wrapper return fn(args, kwargs) File "C:\Users\hi\Anaconda3\lib\site-packages\ipykernel\kernelbase.py", line 283, in dispatcher return self.dispatch_shell(stream, msg) File "C:\Users\hi\Anaconda3\lib\site-packages\ipykernel\kernelbase.py", line 233, in dispatch_shell handler(stream, idents, msg) File "C:\Users\hi\Anaconda3\lib\site-packages\ipykernel\kernelbase.py", line 399, in execute_request user_expressions, allow_stdin) File "C:\Users\hi\Anaconda3\lib\site-packages\ipykernel\ipkernel.py", line 208, in do_execute res = shell.run_cell(code, store_history=store_history, silent=silent) File "C:\Users\hi\Anaconda3\lib\site-packages\ipykernel\zmqshell.py", line 537, in run_cell return super(ZMQInteractiveShell, self).run_cell(*args, *kwargs) File "C:\Users\hi\Anaconda3\lib\site-packages\IPython\core\interactiveshell.py", line 2662, in run_cell raw_cell, store_history, silent, shell_futures) File "C:\Users\hi\Anaconda3\lib\site-packages\IPython\core\interactiveshell.py", line 2785, in _run_cell interactivity=interactivity, compiler=compiler, result=result) File "C:\Users\hi\Anaconda3\lib\site-packages\IPython\core\interactiveshell.py", line 2909, in run_ast_nodes if self.run_code(code, result): File "C:\Users\hi\Anaconda3\lib\site-packages\IPython\core\interactiveshell.py", line 2963, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "", line 1, in runfile('F:/bp/computer_vision/yolo_train/train.py', wdir='F:/bp/computer_vision/yolo_train') File "C:\Users\hi\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 705, in runfile execfile(filename, namespace) File "C:\Users\hi\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 102, in execfile exec(compile(f.read(), filename, 'exec'), namespace) File "F:/bp/computer_vision/yolo_train/train.py", line 24, in tfnet = TFNet(options) File "f:\bp\computer_vision\yolo_train\darkflow\darkflow\net\build.py", line 76, in init self.setup_meta_ops() File "f:\bp\computer_vision\yolo_train\darkflow\darkflow\net\build.py", line 139, in setup_meta_ops if self.FLAGS.train: self.build_train_op() File "f:\bp\computer_vision\yolo_train\darkflow\darkflow\net\help.py", line 15, in build_train_op self.framework.loss(self.out) File "f:\bp\computer_vision\yolo_train\darkflow\darkflow\net\yolov2\train.py", line 56, in loss net_out_reshape = tf.reshape(net_out, [-1, H, W, B, (4 + 1 + C)]) File "C:\Users\hi\Anaconda3\lib\site-packages\tensorflow\python\ops\gen_array_ops.py", line 7434, in reshape "Reshape", tensor=tensor, shape=shape, name=name) File "C:\Users\hi\Anaconda3\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 787, in _apply_op_helper op_def=op_def) File "C:\Users\hi\Anaconda3\lib\site-packages\tensorflow\python\util\deprecation.py", line 454, in new_func return func(args, **kwargs) File "C:\Users\hi\Anaconda3\lib\site-packages\tensorflow\python\framework\ops.py", line 3155, in create_op op_def=op_def) File "C:\Users\hi\Anaconda3\lib\site-packages\tensorflow\python\framework\ops.py", line 1717, in init self._traceback = tf_stack.extract_stack()

InvalidArgumentError (see above for traceback): Input to reshape is a tensor with 1227400 values, but the requested shape requires a multiple of 10830 [[Node: Reshape = Reshape[T=DT_FLOAT, Tshape=DT_INT32, _device="/job:localhost/replica:0/task:0/device:CPU:0"](BiasAdd_22, Reshape/shape)]]

deep-diver commented 5 years ago

Looks like you have an invalid shape of image to convert to 10830 which is? I want to know, each values of H, W, B, and C. Also shape or net_out should be delivered as well.

SreenijaK commented 5 years ago

where do i check for those values

deep-diver commented 5 years ago

why dont you write codes?

SreenijaK commented 5 years ago

These are the values h-19, w-19, b-5, c-1 net_out_reshape is Tensor("Reshape:0", shape=(?, 19, 19, 5, 6), dtype=float32)

deep-diver commented 5 years ago

yeah net_out_reshape must be (?, 19, 19, 5, 6), but would it be convertible for net_out to net_out_reshape? In order to know, I need to know the shape of net_out as well.