Code Monkey home page Code Monkey logo

faster_rcnn_for_open_images_dataset_keras's People

Contributors

adimyth avatar rockyxu66 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

faster_rcnn_for_open_images_dataset_keras's Issues

How to use different base network

Sir , i want to use different base network, can you please tell me the procedure
I know you use transfer learning , but can i use pre train weights of a simple image classification model

Hello! there are one question

When i trans nn_base from resnet to vgg there are big different can u using vgg as nn_base before?
resnet :good detection
vgg:bad detection

TypeError: 'list' object is not callable

Can I ask how to solve this? I have my own dataset, https://drive.google.com/drive/folders/1Av5ISw_IBz_ZxFXM-HcjgKgRxSC9KEGR?usp=sharing
this is the drive I linked. Did I do any mistake when saving the file?

Parsing annotation files
idx=1
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-87-7aa9ec0d28a7> in <module>()
      1 st = time.time()
      2 
----> 3 train_imgs, classes_count, class_mapping = get_data(train_path)
      4 print()
      5 print('Spend %0.2f mins to load the data' % ((time.time()-st)/60) )

<ipython-input-72-8dead35fa357> in get_data(input_path)
     47                         #       ---------------------x2,y2
     48 
---> 49                         [filename,x1,y1,x2,y2,class_name] = line_split()
     50 
     51                         if class_name not in classes_count:

TypeError: 'list' object is not callable

Exception: Incompatible shapes: [1,18,30,36] vs. [1,9,15,36] error while training

Hi, I am facing the following issue when I execute the cell which starts the training.
Epoch 1/40
Exception: Incompatible shapes: [1,18,30,36] vs. [1,9,15,36]
[[node gradients/sub_2_grad/BroadcastGradientArgs (defined at /home/jitesh/test_env/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py:2138) ]].

The full traceback is as follows:

Epoch 1/40
Exception: Incompatible shapes: [1,18,30,36] vs. [1,9,15,36]
[[node gradients/sub_2_grad/BroadcastGradientArgs (defined at /home/jitesh/test_env/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py:2138) ]]

Caused by op 'gradients/sub_2_grad/BroadcastGradientArgs', defined at:
File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/jitesh/test_env/lib/python3.6/site-packages/ipykernel_launcher.py", line 16, in
app.launch_new_instance()
File "/home/jitesh/test_env/lib/python3.6/site-packages/traitlets/config/application.py", line 658, in launch_instance
app.start()
File "/home/jitesh/test_env/lib/python3.6/site-packages/ipykernel/kernelapp.py", line 505, in start
self.io_loop.start()
File "/home/jitesh/test_env/lib/python3.6/site-packages/tornado/platform/asyncio.py", line 132, in start
self.asyncio_loop.run_forever()
File "/usr/lib/python3.6/asyncio/base_events.py", line 427, in run_forever
self._run_once()
File "/usr/lib/python3.6/asyncio/base_events.py", line 1440, in _run_once
handle._run()
File "/usr/lib/python3.6/asyncio/events.py", line 145, in _run
self._callback(*self._args)
File "/home/jitesh/test_env/lib/python3.6/site-packages/tornado/ioloop.py", line 758, in _run_callback
ret = callback()
File "/home/jitesh/test_env/lib/python3.6/site-packages/tornado/stack_context.py", line 300, in null_wrapper
return fn(*args, **kwargs)
File "/home/jitesh/test_env/lib/python3.6/site-packages/tornado/gen.py", line 1233, in inner
self.run()
File "/home/jitesh/test_env/lib/python3.6/site-packages/tornado/gen.py", line 1147, in run
yielded = self.gen.send(value)
File "/home/jitesh/test_env/lib/python3.6/site-packages/ipykernel/kernelbase.py", line 357, in process_one
yield gen.maybe_future(dispatch(*args))
File "/home/jitesh/test_env/lib/python3.6/site-packages/tornado/gen.py", line 326, in wrapper
yielded = next(result)
File "/home/jitesh/test_env/lib/python3.6/site-packages/ipykernel/kernelbase.py", line 267, in dispatch_shell
yield gen.maybe_future(handler(stream, idents, msg))
File "/home/jitesh/test_env/lib/python3.6/site-packages/tornado/gen.py", line 326, in wrapper
yielded = next(result)
File "/home/jitesh/test_env/lib/python3.6/site-packages/ipykernel/kernelbase.py", line 534, in execute_request
user_expressions, allow_stdin,
File "/home/jitesh/test_env/lib/python3.6/site-packages/tornado/gen.py", line 326, in wrapper
yielded = next(result)
File "/home/jitesh/test_env/lib/python3.6/site-packages/ipykernel/ipkernel.py", line 294, in do_execute
res = shell.run_cell(code, store_history=store_history, silent=silent)
File "/home/jitesh/test_env/lib/python3.6/site-packages/ipykernel/zmqshell.py", line 536, in run_cell
return super(ZMQInteractiveShell, self).run_cell(*args, **kwargs)
File "/home/jitesh/test_env/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 2843, in run_cell
raw_cell, store_history, silent, shell_futures)
File "/home/jitesh/test_env/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 2869, in _run_cell
return runner(coro)
File "/home/jitesh/test_env/lib/python3.6/site-packages/IPython/core/async_helpers.py", line 67, in _pseudo_sync_runner
coro.send(None)
File "/home/jitesh/test_env/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 3044, in run_cell_async
interactivity=interactivity, compiler=compiler, result=result)
File "/home/jitesh/test_env/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 3209, in run_ast_nodes
if (yield from self.run_code(code, result)):
File "/home/jitesh/test_env/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 3291, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "", line 23, in
loss_rpn = model_rpn.train_on_batch(X, Y)
File "/home/jitesh/test_env/lib/python3.6/site-packages/keras/engine/training.py", line 1620, in train_on_batch
self._make_train_function()
File "/home/jitesh/test_env/lib/python3.6/site-packages/keras/engine/training.py", line 1002, in _make_train_function
self.total_loss)
File "/home/jitesh/test_env/lib/python3.6/site-packages/keras/optimizers.py", line 381, in get_updates
grads = self.get_gradients(loss, params)
File "/home/jitesh/test_env/lib/python3.6/site-packages/keras/optimizers.py", line 47, in get_gradients
grads = K.gradients(loss, params)
File "/home/jitesh/test_env/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py", line 2138, in gradients
return tf.gradients(loss, variables, colocate_gradients_with_ops=True)
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/ops/gradients_impl.py", line 664, in gradients
unconnected_gradients)
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/ops/gradients_impl.py", line 965, in _GradientsHelper
lambda: grad_fn(op, *out_grads))
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/ops/gradients_impl.py", line 420, in _MaybeCompile
return grad_fn() # Exit early
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/ops/gradients_impl.py", line 965, in
lambda: grad_fn(op, *out_grads))
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/ops/math_grad.py", line 923, in _SubGrad
rx, ry = gen_array_ops.broadcast_gradient_args(sx, sy)
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/ops/gen_array_ops.py", line 750, in broadcast_gradient_args
"BroadcastGradientArgs", s0=s0, s1=s1, name=name)
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 788, in _apply_op_helper
op_def=op_def)
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py", line 507, in new_func
return func(*args, **kwargs)
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3300, in create_op
op_def=op_def)
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1801, in init
self._traceback = tf_stack.extract_stack()

...which was originally created as op 'sub_2', defined at:
File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
[elided 25 identical lines from previous traceback]
File "/home/jitesh/test_env/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 3291, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "", line 3, in
model_rpn.compile(optimizer=optimizer, loss=[rpn_loss_cls(num_anchors), rpn_loss_regr(num_anchors)])
File "/home/jitesh/test_env/lib/python3.6/site-packages/keras/engine/training.py", line 899, in compile
sample_weight, mask)
File "/home/jitesh/test_env/lib/python3.6/site-packages/keras/engine/training.py", line 430, in weighted
score_array = fn(y_true, y_pred)
File "", line 13, in rpn_loss_regr_fixed_num
x = y_true[:, :, :, 4 * num_anchors:] - y_pred
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/ops/math_ops.py", line 812, in binary_op_wrapper
return func(x, y, name=name)
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/ops/gen_math_ops.py", line 9536, in sub
"Sub", x=x, y=y, name=name)
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 788, in _apply_op_helper
op_def=op_def)
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py", line 507, in new_func
return func(*args, **kwargs)
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3300, in create_op
op_def=op_def)
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1801, in init
self._traceback = tf_stack.extract_stack()

InvalidArgumentError (see above for traceback): Incompatible shapes: [1,18,30,36] vs. [1,9,15,36]
[[node gradients/sub_2_grad/BroadcastGradientArgs (defined at /home/jitesh/test_env/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py:2138) ]]

Exception: Incompatible shapes: [1,18,30,36] vs. [1,9,15,36]
[[node gradients/sub_2_grad/BroadcastGradientArgs (defined at /home/jitesh/test_env/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py:2138) ]]

Caused by op 'gradients/sub_2_grad/BroadcastGradientArgs', defined at:
File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/jitesh/test_env/lib/python3.6/site-packages/ipykernel_launcher.py", line 16, in
app.launch_new_instance()
File "/home/jitesh/test_env/lib/python3.6/site-packages/traitlets/config/application.py", line 658, in launch_instance
app.start()
File "/home/jitesh/test_env/lib/python3.6/site-packages/ipykernel/kernelapp.py", line 505, in start
self.io_loop.start()
File "/home/jitesh/test_env/lib/python3.6/site-packages/tornado/platform/asyncio.py", line 132, in start
self.asyncio_loop.run_forever()
File "/usr/lib/python3.6/asyncio/base_events.py", line 427, in run_forever
self._run_once()
File "/usr/lib/python3.6/asyncio/base_events.py", line 1440, in _run_once
handle._run()
File "/usr/lib/python3.6/asyncio/events.py", line 145, in _run
self._callback(*self._args)
File "/home/jitesh/test_env/lib/python3.6/site-packages/tornado/ioloop.py", line 758, in _run_callback
ret = callback()
File "/home/jitesh/test_env/lib/python3.6/site-packages/tornado/stack_context.py", line 300, in null_wrapper
return fn(*args, **kwargs)
File "/home/jitesh/test_env/lib/python3.6/site-packages/tornado/gen.py", line 1233, in inner
self.run()
File "/home/jitesh/test_env/lib/python3.6/site-packages/tornado/gen.py", line 1147, in run
yielded = self.gen.send(value)
File "/home/jitesh/test_env/lib/python3.6/site-packages/ipykernel/kernelbase.py", line 357, in process_one
yield gen.maybe_future(dispatch(*args))
File "/home/jitesh/test_env/lib/python3.6/site-packages/tornado/gen.py", line 326, in wrapper
yielded = next(result)
File "/home/jitesh/test_env/lib/python3.6/site-packages/ipykernel/kernelbase.py", line 267, in dispatch_shell
yield gen.maybe_future(handler(stream, idents, msg))
File "/home/jitesh/test_env/lib/python3.6/site-packages/tornado/gen.py", line 326, in wrapper
yielded = next(result)
File "/home/jitesh/test_env/lib/python3.6/site-packages/ipykernel/kernelbase.py", line 534, in execute_request
user_expressions, allow_stdin,
File "/home/jitesh/test_env/lib/python3.6/site-packages/tornado/gen.py", line 326, in wrapper
yielded = next(result)
File "/home/jitesh/test_env/lib/python3.6/site-packages/ipykernel/ipkernel.py", line 294, in do_execute
res = shell.run_cell(code, store_history=store_history, silent=silent)
File "/home/jitesh/test_env/lib/python3.6/site-packages/ipykernel/zmqshell.py", line 536, in run_cell
return super(ZMQInteractiveShell, self).run_cell(*args, **kwargs)
File "/home/jitesh/test_env/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 2843, in run_cell
raw_cell, store_history, silent, shell_futures)
File "/home/jitesh/test_env/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 2869, in _run_cell
return runner(coro)
File "/home/jitesh/test_env/lib/python3.6/site-packages/IPython/core/async_helpers.py", line 67, in _pseudo_sync_runner
coro.send(None)
File "/home/jitesh/test_env/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 3044, in run_cell_async
interactivity=interactivity, compiler=compiler, result=result)
File "/home/jitesh/test_env/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 3209, in run_ast_nodes
if (yield from self.run_code(code, result)):
File "/home/jitesh/test_env/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 3291, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "", line 23, in
loss_rpn = model_rpn.train_on_batch(X, Y)
File "/home/jitesh/test_env/lib/python3.6/site-packages/keras/engine/training.py", line 1620, in train_on_batch
self._make_train_function()
File "/home/jitesh/test_env/lib/python3.6/site-packages/keras/engine/training.py", line 1002, in _make_train_function
self.total_loss)
File "/home/jitesh/test_env/lib/python3.6/site-packages/keras/optimizers.py", line 381, in get_updates
grads = self.get_gradients(loss, params)
File "/home/jitesh/test_env/lib/python3.6/site-packages/keras/optimizers.py", line 47, in get_gradients
grads = K.gradients(loss, params)
File "/home/jitesh/test_env/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py", line 2138, in gradients
return tf.gradients(loss, variables, colocate_gradients_with_ops=True)
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/ops/gradients_impl.py", line 664, in gradients
unconnected_gradients)
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/ops/gradients_impl.py", line 965, in _GradientsHelper
lambda: grad_fn(op, *out_grads))
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/ops/gradients_impl.py", line 420, in _MaybeCompile
return grad_fn() # Exit early
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/ops/gradients_impl.py", line 965, in
lambda: grad_fn(op, *out_grads))
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/ops/math_grad.py", line 923, in _SubGrad
rx, ry = gen_array_ops.broadcast_gradient_args(sx, sy)
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/ops/gen_array_ops.py", line 750, in broadcast_gradient_args
"BroadcastGradientArgs", s0=s0, s1=s1, name=name)
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 788, in _apply_op_helper
op_def=op_def)
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py", line 507, in new_func
return func(*args, **kwargs)
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3300, in create_op
op_def=op_def)
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1801, in init
self._traceback = tf_stack.extract_stack()

...which was originally created as op 'sub_2', defined at:
File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
[elided 25 identical lines from previous traceback]
File "/home/jitesh/test_env/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 3291, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "", line 3, in
model_rpn.compile(optimizer=optimizer, loss=[rpn_loss_cls(num_anchors), rpn_loss_regr(num_anchors)])
File "/home/jitesh/test_env/lib/python3.6/site-packages/keras/engine/training.py", line 899, in compile
sample_weight, mask)
File "/home/jitesh/test_env/lib/python3.6/site-packages/keras/engine/training.py", line 430, in weighted
score_array = fn(y_true, y_pred)
File "", line 13, in rpn_loss_regr_fixed_num
x = y_true[:, :, :, 4 * num_anchors:] - y_pred
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/ops/math_ops.py", line 812, in binary_op_wrapper
return func(x, y, name=name)
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/ops/gen_math_ops.py", line 9536, in sub
"Sub", x=x, y=y, name=name)
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 788, in _apply_op_helper
op_def=op_def)
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py", line 507, in new_func
return func(*args, **kwargs)
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3300, in create_op
op_def=op_def)
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1801, in init
self._traceback = tf_stack.extract_stack()

InvalidArgumentError (see above for traceback): Incompatible shapes: [1,18,30,36] vs. [1,9,15,36]
[[node gradients/sub_2_grad/BroadcastGradientArgs (defined at /home/jitesh/test_env/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py:2138) ]]

Exception: Incompatible shapes: [1,9,15,9] vs. [1,18,30,9]
[[node gradients/logistic_loss/mul_grad/BroadcastGradientArgs (defined at /home/jitesh/test_env/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py:2138) ]]

Caused by op 'gradients/logistic_loss/mul_grad/BroadcastGradientArgs', defined at:
File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/jitesh/test_env/lib/python3.6/site-packages/ipykernel_launcher.py", line 16, in
app.launch_new_instance()
File "/home/jitesh/test_env/lib/python3.6/site-packages/traitlets/config/application.py", line 658, in launch_instance
app.start()
File "/home/jitesh/test_env/lib/python3.6/site-packages/ipykernel/kernelapp.py", line 505, in start
self.io_loop.start()
File "/home/jitesh/test_env/lib/python3.6/site-packages/tornado/platform/asyncio.py", line 132, in start
self.asyncio_loop.run_forever()
File "/usr/lib/python3.6/asyncio/base_events.py", line 427, in run_forever
self._run_once()
File "/usr/lib/python3.6/asyncio/base_events.py", line 1440, in _run_once
handle._run()
File "/usr/lib/python3.6/asyncio/events.py", line 145, in _run
self._callback(*self._args)
File "/home/jitesh/test_env/lib/python3.6/site-packages/tornado/ioloop.py", line 758, in _run_callback
ret = callback()
File "/home/jitesh/test_env/lib/python3.6/site-packages/tornado/stack_context.py", line 300, in null_wrapper
return fn(*args, **kwargs)
File "/home/jitesh/test_env/lib/python3.6/site-packages/tornado/gen.py", line 1233, in inner
self.run()
File "/home/jitesh/test_env/lib/python3.6/site-packages/tornado/gen.py", line 1147, in run
yielded = self.gen.send(value)
File "/home/jitesh/test_env/lib/python3.6/site-packages/ipykernel/kernelbase.py", line 357, in process_one
yield gen.maybe_future(dispatch(*args))
File "/home/jitesh/test_env/lib/python3.6/site-packages/tornado/gen.py", line 326, in wrapper
yielded = next(result)
File "/home/jitesh/test_env/lib/python3.6/site-packages/ipykernel/kernelbase.py", line 267, in dispatch_shell
yield gen.maybe_future(handler(stream, idents, msg))
File "/home/jitesh/test_env/lib/python3.6/site-packages/tornado/gen.py", line 326, in wrapper
yielded = next(result)
File "/home/jitesh/test_env/lib/python3.6/site-packages/ipykernel/kernelbase.py", line 534, in execute_request
user_expressions, allow_stdin,
File "/home/jitesh/test_env/lib/python3.6/site-packages/tornado/gen.py", line 326, in wrapper
yielded = next(result)
File "/home/jitesh/test_env/lib/python3.6/site-packages/ipykernel/ipkernel.py", line 294, in do_execute
res = shell.run_cell(code, store_history=store_history, silent=silent)
File "/home/jitesh/test_env/lib/python3.6/site-packages/ipykernel/zmqshell.py", line 536, in run_cell
return super(ZMQInteractiveShell, self).run_cell(*args, **kwargs)
File "/home/jitesh/test_env/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 2843, in run_cell
raw_cell, store_history, silent, shell_futures)
File "/home/jitesh/test_env/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 2869, in _run_cell
return runner(coro)
File "/home/jitesh/test_env/lib/python3.6/site-packages/IPython/core/async_helpers.py", line 67, in _pseudo_sync_runner
coro.send(None)
File "/home/jitesh/test_env/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 3044, in run_cell_async
interactivity=interactivity, compiler=compiler, result=result)
File "/home/jitesh/test_env/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 3209, in run_ast_nodes
if (yield from self.run_code(code, result)):
File "/home/jitesh/test_env/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 3291, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "", line 23, in
loss_rpn = model_rpn.train_on_batch(X, Y)
File "/home/jitesh/test_env/lib/python3.6/site-packages/keras/engine/training.py", line 1620, in train_on_batch
self._make_train_function()
File "/home/jitesh/test_env/lib/python3.6/site-packages/keras/engine/training.py", line 1002, in _make_train_function
self.total_loss)
File "/home/jitesh/test_env/lib/python3.6/site-packages/keras/optimizers.py", line 381, in get_updates
grads = self.get_gradients(loss, params)
File "/home/jitesh/test_env/lib/python3.6/site-packages/keras/optimizers.py", line 47, in get_gradients
grads = K.gradients(loss, params)
File "/home/jitesh/test_env/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py", line 2138, in gradients
return tf.gradients(loss, variables, colocate_gradients_with_ops=True)
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/ops/gradients_impl.py", line 664, in gradients
unconnected_gradients)
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/ops/gradients_impl.py", line 965, in _GradientsHelper
lambda: grad_fn(op, *out_grads))
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/ops/gradients_impl.py", line 420, in _MaybeCompile
return grad_fn() # Exit early
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/ops/gradients_impl.py", line 965, in
lambda: grad_fn(op, *out_grads))
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/ops/math_grad.py", line 940, in _MulGrad
rx, ry = gen_array_ops.broadcast_gradient_args(sx, sy)
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/ops/gen_array_ops.py", line 750, in broadcast_gradient_args
"BroadcastGradientArgs", s0=s0, s1=s1, name=name)
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 788, in _apply_op_helper
op_def=op_def)
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py", line 507, in new_func
return func(*args, **kwargs)
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3300, in create_op
op_def=op_def)
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1801, in init
self._traceback = tf_stack.extract_stack()

...which was originally created as op 'logistic_loss/mul', defined at:
File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
[elided 25 identical lines from previous traceback]
File "/home/jitesh/test_env/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 3291, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "", line 3, in
model_rpn.compile(optimizer=optimizer, loss=[rpn_loss_cls(num_anchors), rpn_loss_regr(num_anchors)])
File "/home/jitesh/test_env/lib/python3.6/site-packages/keras/engine/training.py", line 899, in compile
sample_weight, mask)
File "/home/jitesh/test_env/lib/python3.6/site-packages/keras/engine/training.py", line 430, in weighted
score_array = fn(y_true, y_pred)
File "", line 38, in rpn_loss_cls_fixed_num
return lambda_rpn_class * K.sum(y_true[:, :, :, :num_anchors] * K.binary_crossentropy(y_pred[:, :, :, :], y_true[:, :, :, num_anchors:])) / K.sum(epsilon + y_true[:, :, :, :num_anchors])
File "/home/jitesh/test_env/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py", line 2645, in binary_crossentropy
logits=output)
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/ops/nn_impl.py", line 182, in sigmoid_cross_entropy_with_logits
relu_logits - logits * labels,
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/ops/math_ops.py", line 812, in binary_op_wrapper
return func(x, y, name=name)
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/ops/math_ops.py", line 1078, in _mul_dispatch
return gen_math_ops.mul(x, y, name=name)
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/ops/gen_math_ops.py", line 5860, in mul
"Mul", x=x, y=y, name=name)
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 788, in _apply_op_helper
op_def=op_def)
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py", line 507, in new_func
return func(*args, **kwargs)
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3300, in create_op
op_def=op_def)
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1801, in init
self._traceback = tf_stack.extract_stack()

InvalidArgumentError (see above for traceback): Incompatible shapes: [1,9,15,9] vs. [1,18,30,9]
[[node gradients/logistic_loss/mul_grad/BroadcastGradientArgs (defined at /home/jitesh/test_env/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py:2138) ]]

Exception: Incompatible shapes: [1,9,15,9] vs. [1,18,30,9]
[[node gradients/logistic_loss/mul_grad/BroadcastGradientArgs (defined at /home/jitesh/test_env/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py:2138) ]]

Caused by op 'gradients/logistic_loss/mul_grad/BroadcastGradientArgs', defined at:
File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/jitesh/test_env/lib/python3.6/site-packages/ipykernel_launcher.py", line 16, in
app.launch_new_instance()
File "/home/jitesh/test_env/lib/python3.6/site-packages/traitlets/config/application.py", line 658, in launch_instance
app.start()
File "/home/jitesh/test_env/lib/python3.6/site-packages/ipykernel/kernelapp.py", line 505, in start
self.io_loop.start()
File "/home/jitesh/test_env/lib/python3.6/site-packages/tornado/platform/asyncio.py", line 132, in start
self.asyncio_loop.run_forever()
File "/usr/lib/python3.6/asyncio/base_events.py", line 427, in run_forever
self._run_once()
File "/usr/lib/python3.6/asyncio/base_events.py", line 1440, in _run_once
handle._run()
File "/usr/lib/python3.6/asyncio/events.py", line 145, in _run
self._callback(*self._args)
File "/home/jitesh/test_env/lib/python3.6/site-packages/tornado/ioloop.py", line 758, in _run_callback
ret = callback()
File "/home/jitesh/test_env/lib/python3.6/site-packages/tornado/stack_context.py", line 300, in null_wrapper
return fn(*args, **kwargs)
File "/home/jitesh/test_env/lib/python3.6/site-packages/tornado/gen.py", line 1233, in inner
self.run()
File "/home/jitesh/test_env/lib/python3.6/site-packages/tornado/gen.py", line 1147, in run
yielded = self.gen.send(value)
File "/home/jitesh/test_env/lib/python3.6/site-packages/ipykernel/kernelbase.py", line 357, in process_one
yield gen.maybe_future(dispatch(*args))
File "/home/jitesh/test_env/lib/python3.6/site-packages/tornado/gen.py", line 326, in wrapper
yielded = next(result)
File "/home/jitesh/test_env/lib/python3.6/site-packages/ipykernel/kernelbase.py", line 267, in dispatch_shell
yield gen.maybe_future(handler(stream, idents, msg))
File "/home/jitesh/test_env/lib/python3.6/site-packages/tornado/gen.py", line 326, in wrapper
yielded = next(result)
File "/home/jitesh/test_env/lib/python3.6/site-packages/ipykernel/kernelbase.py", line 534, in execute_request
user_expressions, allow_stdin,
File "/home/jitesh/test_env/lib/python3.6/site-packages/tornado/gen.py", line 326, in wrapper
yielded = next(result)
File "/home/jitesh/test_env/lib/python3.6/site-packages/ipykernel/ipkernel.py", line 294, in do_execute
res = shell.run_cell(code, store_history=store_history, silent=silent)
File "/home/jitesh/test_env/lib/python3.6/site-packages/ipykernel/zmqshell.py", line 536, in run_cell
return super(ZMQInteractiveShell, self).run_cell(*args, **kwargs)
File "/home/jitesh/test_env/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 2843, in run_cell
raw_cell, store_history, silent, shell_futures)
File "/home/jitesh/test_env/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 2869, in _run_cell
return runner(coro)
File "/home/jitesh/test_env/lib/python3.6/site-packages/IPython/core/async_helpers.py", line 67, in _pseudo_sync_runner
coro.send(None)
File "/home/jitesh/test_env/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 3044, in run_cell_async
interactivity=interactivity, compiler=compiler, result=result)
File "/home/jitesh/test_env/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 3209, in run_ast_nodes
if (yield from self.run_code(code, result)):
File "/home/jitesh/test_env/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 3291, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "", line 23, in
loss_rpn = model_rpn.train_on_batch(X, Y)
File "/home/jitesh/test_env/lib/python3.6/site-packages/keras/engine/training.py", line 1620, in train_on_batch
self._make_train_function()
File "/home/jitesh/test_env/lib/python3.6/site-packages/keras/engine/training.py", line 1002, in _make_train_function
self.total_loss)
File "/home/jitesh/test_env/lib/python3.6/site-packages/keras/optimizers.py", line 381, in get_updates
grads = self.get_gradients(loss, params)
File "/home/jitesh/test_env/lib/python3.6/site-packages/keras/optimizers.py", line 47, in get_gradients
grads = K.gradients(loss, params)
File "/home/jitesh/test_env/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py", line 2138, in gradients
return tf.gradients(loss, variables, colocate_gradients_with_ops=True)
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/ops/gradients_impl.py", line 664, in gradients
unconnected_gradients)
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/ops/gradients_impl.py", line 965, in _GradientsHelper
lambda: grad_fn(op, *out_grads))
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/ops/gradients_impl.py", line 420, in _MaybeCompile
return grad_fn() # Exit early
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/ops/gradients_impl.py", line 965, in
lambda: grad_fn(op, *out_grads))
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/ops/math_grad.py", line 940, in _MulGrad
rx, ry = gen_array_ops.broadcast_gradient_args(sx, sy)
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/ops/gen_array_ops.py", line 750, in broadcast_gradient_args
"BroadcastGradientArgs", s0=s0, s1=s1, name=name)
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 788, in _apply_op_helper
op_def=op_def)
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py", line 507, in new_func
return func(*args, **kwargs)
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3300, in create_op
op_def=op_def)
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1801, in init
self._traceback = tf_stack.extract_stack()

...which was originally created as op 'logistic_loss/mul', defined at:
File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
[elided 25 identical lines from previous traceback]
File "/home/jitesh/test_env/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 3291, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "", line 3, in
model_rpn.compile(optimizer=optimizer, loss=[rpn_loss_cls(num_anchors), rpn_loss_regr(num_anchors)])
File "/home/jitesh/test_env/lib/python3.6/site-packages/keras/engine/training.py", line 899, in compile
sample_weight, mask)
File "/home/jitesh/test_env/lib/python3.6/site-packages/keras/engine/training.py", line 430, in weighted
score_array = fn(y_true, y_pred)
File "", line 38, in rpn_loss_cls_fixed_num
return lambda_rpn_class * K.sum(y_true[:, :, :, :num_anchors] * K.binary_crossentropy(y_pred[:, :, :, :], y_true[:, :, :, num_anchors:])) / K.sum(epsilon + y_true[:, :, :, :num_anchors])
File "/home/jitesh/test_env/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py", line 2645, in binary_crossentropy
logits=output)
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/ops/nn_impl.py", line 182, in sigmoid_cross_entropy_with_logits
relu_logits - logits * labels,
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/ops/math_ops.py", line 812, in binary_op_wrapper
return func(x, y, name=name)
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/ops/math_ops.py", line 1078, in _mul_dispatch
return gen_math_ops.mul(x, y, name=name)
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/ops/gen_math_ops.py", line 5860, in mul
"Mul", x=x, y=y, name=name)
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 788, in _apply_op_helper
op_def=op_def)
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py", line 507, in new_func
return func(*args, **kwargs)
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3300, in create_op
op_def=op_def)
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1801, in init
self._traceback = tf_stack.extract_stack()

InvalidArgumentError (see above for traceback): Incompatible shapes: [1,9,15,9] vs. [1,18,30,9]
[[node gradients/logistic_loss/mul_grad/BroadcastGradientArgs (defined at /home/jitesh/test_env/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py:2138) ]]

Exception: Incompatible shapes: [1,9,15,9] vs. [1,18,30,9]
[[node logistic_loss/mul (defined at /home/jitesh/test_env/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py:2645) ]]

Caused by op 'logistic_loss/mul', defined at:
File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/jitesh/test_env/lib/python3.6/site-packages/ipykernel_launcher.py", line 16, in
app.launch_new_instance()
File "/home/jitesh/test_env/lib/python3.6/site-packages/traitlets/config/application.py", line 658, in launch_instance
app.start()
File "/home/jitesh/test_env/lib/python3.6/site-packages/ipykernel/kernelapp.py", line 505, in start
self.io_loop.start()
File "/home/jitesh/test_env/lib/python3.6/site-packages/tornado/platform/asyncio.py", line 132, in start
self.asyncio_loop.run_forever()
File "/usr/lib/python3.6/asyncio/base_events.py", line 427, in run_forever
self._run_once()
File "/usr/lib/python3.6/asyncio/base_events.py", line 1440, in _run_once
handle._run()
File "/usr/lib/python3.6/asyncio/events.py", line 145, in _run
self._callback(*self._args)
File "/home/jitesh/test_env/lib/python3.6/site-packages/tornado/ioloop.py", line 758, in _run_callback
ret = callback()
File "/home/jitesh/test_env/lib/python3.6/site-packages/tornado/stack_context.py", line 300, in null_wrapper
return fn(*args, **kwargs)
File "/home/jitesh/test_env/lib/python3.6/site-packages/tornado/gen.py", line 1233, in inner
self.run()
File "/home/jitesh/test_env/lib/python3.6/site-packages/tornado/gen.py", line 1147, in run
yielded = self.gen.send(value)
File "/home/jitesh/test_env/lib/python3.6/site-packages/ipykernel/kernelbase.py", line 357, in process_one
yield gen.maybe_future(dispatch(*args))
File "/home/jitesh/test_env/lib/python3.6/site-packages/tornado/gen.py", line 326, in wrapper
yielded = next(result)
File "/home/jitesh/test_env/lib/python3.6/site-packages/ipykernel/kernelbase.py", line 267, in dispatch_shell
yield gen.maybe_future(handler(stream, idents, msg))
File "/home/jitesh/test_env/lib/python3.6/site-packages/tornado/gen.py", line 326, in wrapper
yielded = next(result)
File "/home/jitesh/test_env/lib/python3.6/site-packages/ipykernel/kernelbase.py", line 534, in execute_request
user_expressions, allow_stdin,
File "/home/jitesh/test_env/lib/python3.6/site-packages/tornado/gen.py", line 326, in wrapper
yielded = next(result)
File "/home/jitesh/test_env/lib/python3.6/site-packages/ipykernel/ipkernel.py", line 294, in do_execute
res = shell.run_cell(code, store_history=store_history, silent=silent)
File "/home/jitesh/test_env/lib/python3.6/site-packages/ipykernel/zmqshell.py", line 536, in run_cell
return super(ZMQInteractiveShell, self).run_cell(*args, **kwargs)
File "/home/jitesh/test_env/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 2843, in run_cell
raw_cell, store_history, silent, shell_futures)
File "/home/jitesh/test_env/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 2869, in _run_cell
return runner(coro)
File "/home/jitesh/test_env/lib/python3.6/site-packages/IPython/core/async_helpers.py", line 67, in _pseudo_sync_runner
coro.send(None)
File "/home/jitesh/test_env/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 3044, in run_cell_async
interactivity=interactivity, compiler=compiler, result=result)
File "/home/jitesh/test_env/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 3209, in run_ast_nodes
if (yield from self.run_code(code, result)):
File "/home/jitesh/test_env/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 3291, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "", line 3, in
model_rpn.compile(optimizer=optimizer, loss=[rpn_loss_cls(num_anchors), rpn_loss_regr(num_anchors)])
File "/home/jitesh/test_env/lib/python3.6/site-packages/keras/engine/training.py", line 899, in compile
sample_weight, mask)
File "/home/jitesh/test_env/lib/python3.6/site-packages/keras/engine/training.py", line 430, in weighted
score_array = fn(y_true, y_pred)
File "", line 38, in rpn_loss_cls_fixed_num
return lambda_rpn_class * K.sum(y_true[:, :, :, :num_anchors] * K.binary_crossentropy(y_pred[:, :, :, :], y_true[:, :, :, num_anchors:])) / K.sum(epsilon + y_true[:, :, :, :num_anchors])
File "/home/jitesh/test_env/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py", line 2645, in binary_crossentropy
logits=output)
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/ops/nn_impl.py", line 182, in sigmoid_cross_entropy_with_logits
relu_logits - logits * labels,
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/ops/math_ops.py", line 812, in binary_op_wrapper
return func(x, y, name=name)
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/ops/math_ops.py", line 1078, in _mul_dispatch
return gen_math_ops.mul(x, y, name=name)
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/ops/gen_math_ops.py", line 5860, in mul
"Mul", x=x, y=y, name=name)
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 788, in _apply_op_helper
op_def=op_def)
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py", line 507, in new_func
return func(*args, **kwargs)
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3300, in create_op
op_def=op_def)
File "/home/jitesh/test_env/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1801, in init
self._traceback = tf_stack.extract_stack()

InvalidArgumentError (see above for traceback): Incompatible shapes: [1,9,15,9] vs. [1,18,30,9]
[[node logistic_loss/mul (defined at /home/jitesh/test_env/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py:2645) ]]

No box drawn for objects

We trained the model, in frcnn_test_vgg.ipynb In [37], the images were shown but there were no boxes drawn to indicate which class does the object belong.

print('Elapsed time = {}'.format(time.time() - st))
print(all_dets)

The output of print(all_dets) is just [ ].
I tried reducing treshold value to 0.3, and it didn't work.

Could you please help,
Thank you.

Exception: a must be non-empty

Hi. Thanks for great work! It helps me very much.
I have a custom dataset. I rewrite only get_data function to be working with my dataset. It produces exact same output as yours. All another code is default (i tried to change some parameters but reseted because it also didn't work with same error as in description).
Exception "a must be non-empty" is thrown here:

try:
    selected_neg_samples = np.random.choice(neg_samples, C.num_rois - len(selected_pos_samples), replace=False).tolist()
except:
     selected_neg_samples = np.random.choice(neg_samples, C.num_rois - len(selected_pos_samples), replace=True).tolist()

It throws from both choice() calls often. And I don't understand why there aren't negative samples. Also why it can't normally process empty array?
Thanks for help!

Error: <Could not load pretrained model weights> ocurred while executing frcnn_train_vgg.ipynb

While training the model, I facing problem of loading the VGG_16_weights(pretrained).

As per suggestion, First I have downloaded 'vgg16_weights_tf_dim_ordering_tf_kernels.h5' from keras application folder.

Below is the code for downloading:

from keras.applications.vgg16 import VGG16

load the model

model = VGG16()

Output:
Downloading data from https://github.com/fchollet/deep-learning-models/releases/download/v0.1/vgg16_weights_tf_dim_ordering_tf_kernels.h5
553467904/553467096 [==============================] - 529s 1us/step

As you can see from the output, I have successfully downloaded the weights.

But when I loaded the weights for training I got the following error:
<
This is the first time of your training
loading weights from Downloads/Faster_RCNN/model/vgg16_weights_tf_dim_ordering_tf_kernels.h5
Could not load pretrained model weights. Weights can be found in the keras application folder https://github.com/fchollet/keras/tree/master/keras/applications

My given path is also correct.
I have also checked multiple times for the path which I have provided but couldn't find anything wrong.

Please help me solving this problem.

Object Detection DataPreprocessing error KeyError: <class 'numpy.object_'>

When I try to download the subclassfile.csv images to a folder, it give me this error at seccion "Download Images":

# Download images
for i in range(len(classes)):
    # Create the directory
    os.mkdir(saved_dirs[i])
    saved_dir = saved_dirs[i]
    for url in urls[i]:
        #print(url)
        img = io.imread(url)
        saved_path = os.path.join(saved_dir, url[-20:])
        io.imsave(saved_path, img)
WARNING: Logging before flag parsing goes to stderr.
W1205 05:46:35.025649 139647583152000 module_wrapper.py:139] From /usr/local/lib/python2.7/dist-packages/tensorflow_estimator/python/estimator/api/_v1/estimator/__init__.py:12: The name tf.estimator.inputs is deprecated. Please use tf.compat.v1.estimator.inputs instead.


KeyErrorTraceback (most recent call last)
<ipython-input-25-a51579775e1b> in <module>()
      7         img = io.imread(url)
      8         saved_path = os.path.join(saved_dir, url[-20:])
----> 9         io.imsave(saved_path, img)

2 frames
/usr/local/lib/python2.7/dist-packages/skimage/util/dtype.pyc in dtype_limits(image, clip_negative)
     55         warn('The default of `clip_negative` in `skimage.util.dtype_limits` '
     56              'will change to `False` in version 0.15.')
---> 57     imin, imax = dtype_range[image.dtype.type]
     58     if clip_negative:
     59         imin = 0

KeyError: <type 'numpy.object_'>

Then I read that you found a good solution with OIDv4_ToolKit but I cant implement it (maybe it's because there is another updated version).
There is another way to fix this? thanks! you made an excelent work.

Found the possible Code error.

if debug_num_pos==0:
    gt_x1, gt_x2 = image_data['bboxes'][0]['x1']*(X.shape[2]/image_data['height']), image_data['bboxes'][0]['x2']*(X.shape[2]/image_data['height'])
    gt_y1, gt_y2 = image_data['bboxes'][0]['y1']*(X.shape[1]/image_data['width']), image_data['bboxes'][0]['y2']*(X.shape[1]/image_data['width'])
    gt_x1, gt_y1, gt_x2, gt_y2 = int(gt_x1), int(gt_y1), int(gt_x2), int(gt_y2)

I wonder if X.shape[2]/image_data['height'] and X.shape[1]/image_data['width'] parts are wrong?
shouldn't it be like:

gt_x1, gt_x2 = image_data["bboxs"][0]["x1"] * ( X.shape[2]/image_data["width"]),image_data["bboxs"][0]["x2"] * (X.shape[2]/image_data["width"])
        gt_y1 , gt_y2 = image_data["bboxs"][0]["y1"]* (X.shape[1]/image_data["height"]),image_data["bboxs"][0]["y2"] * (X.shape[1]/image_data["height"])

ValueError: low >= high

test_imgs = os.listdir(test_base_path)

imgs_path = []
for i in range(12):
idx = np.random.randint(len(test_imgs))
print('idx',idx)
imgs_path.append(test_imgs[idx])

all_imgs = []

classes = {}

ValueError Traceback (most recent call last)
in
3 imgs_path = []
4 for i in range(12):
----> 5 idx = np.random.randint(len(test_imgs))
6 print('idx',idx)
7 imgs_path.append(test_imgs[idx])

mtrand.pyx in numpy.random.mtrand.RandomState.randint()

bounded_integers.pyx in numpy.random.bounded_integers._rand_int64()

ValueError: low >= high

No box obtained during testing the model

Hi,
I am using the trained model (as provided in the medium blog), and when I use it on test data, I do not get any correct predictions. Thus, no bounding boxes are displayed.

Can anybody help me in resolving this issue?

Best,
DJ

How to run the program ?

Hi, as I already told you on Medium, thanks a lot for this work. There's only one thing that's a bit off, the instructions are really vague and not user friendly.

So then I wanted to ask someone more experienced if I am right when I'm saying that in order to successfully train the model with the train.ipynb we first need to run the datapreprocessing.ipynb and also get a save file for the VGG model in the appropriate directory ? Is that correct, and am I forgetting something ?

Thanks to all !

ValueError: too many values to unpack when loading data

Unable to load the data:


ValueError Traceback (most recent call last)
in
3 #--------------------------------------------------------#
4 st = time.time()
----> 5 train_imgs, classes_count, class_mapping = get_data(train_path)
6 print()
7 print('Spend %0.2f mins to load the data' % ((time.time()-st)/60) )

in get_data(input_path)
47 # ---------------------x2,y2
48
---> 49 (filename,x1,y1,x2,y2,class_name) = line_split
50
51 if class_name not in classes_count:

ValueError: too many values to unpack (expected 6)

Upload weights file.

Hey, I find this repository interesting.
it would be nice if you upload weight files.

Model weights

How to get the model weights ?? It just displayed weights cannot be loaded

ImageNet pretrained model

Hi,
I found your Project very interesting. I wanted to ask if I can also pre initialize the Network with ImageNet pretrained weights?

Thank You!
Best Regards
FRK

small target detection

What parameters of "faster rcnn" need to be adjusted when implementing small target detection?

questions about changing the structure

hey, i am using your code to train my own dataset and it works really well, thanks a lot.
i organized your code and added an extra feature extraction net to it (resnet) here
https://github.com/shadow12138/faster-rcnn-keras

i am doing my graduation design, i wonder how i can improve the model a little.
do you know ssd or yolo? they are one-stage detection systems, which do n+1 classification directly. faster r-cnn do the binary classification at the rpn (background or foreground), and then n classification at the classifier layer. i wonder if the rpn layer do the n + 1 classification like what is used in yolo and ssd, will faster r-cnn be faster?

thus i am now trying to cut the roi and classifier layer to make a new structure of faster r-cnn,
but however i changed it, the shape is always incompatible.
will you help me with it...
@RockyXu66

Model_classifier vs model_classifier_only

In the code where he tests the model we make 2 models. The model_classifier and model_classifier_only.

Now the weights are loaded into the model_classifier so I would assume that this model knows how to recognize the images. But in a later stadium when we want to look at the images and predict if something is visible on the picture we use the model_classifier_only. Which is the one without the loaded model.

I really don't understand why this is happening. And when I'm using the model_classifier to look at the image the model just gives a 50/50 chance to background or my class.
(I only have one class beside background)
So I would assume that the model_classifier is not trained. Which I just really can't imagine since it's the model we loaded the weights in.

If someone has any idea. Please let me know. Thanks in advance

Knipsel

What would be the value of "num_roi" in case of 6 objects to be detected?

Thanks for your code.
It helped me a lot.
I want to run the code for 6 number of objects.
I have successfully prepared the data including train.csv, test.csv, annotation.txt, test_annotation.txt for 6 objects.
I want to know, what will be the value of "num_rois" in frcnn_train_vgg.ipynb if 6 objects to be detected.
And Should I have to change anything else in the code.

What this log is for?

When calculating the tw and th there is a log function used. What is the purpose of the log function here?

Thank you.

w,h are the width and height of ground-truth bbox
wa,ha are the width and height of anchor bboxes
# tx = (x - xa) / wa
# ty = (y - ya) / ha
# tw = log(w / wa)
# th = log(h / ha)

KeyError: <class 'numpy.object_'> Occured while executing Object_Detection_DataPreprocessing.ipynb

Hii

Thank You for the project. It is helping me a lot.
While executing Object_Detection_DataPreprocessing.ipynb an error has occurred.
Can you please help me solving this error.

KeyError Traceback (most recent call last)
in ()
8 img = io.imread(url)
9 saved_path = os.path.join(saved_dir, url[-20:])
---> 10 io.imsave(saved_path, img)

C:\ProgramData\Anaconda3\lib\site-packages\skimage\io_io.py in imsave(fname, arr, plugin, **plugin_args)
129 if fname.lower().endswith(('.tiff', '.tif')):
130 plugin = 'tifffile'
--> 131 if is_low_contrast(arr):
132 warn('%s is a low contrast image' % fname)
133 return call_plugin('imsave', fname, arr, plugin=plugin, **plugin_args)

C:\ProgramData\Anaconda3\lib\site-packages\skimage\exposure\exposure.py in is_low_contrast(image, fraction_threshold, lower_percentile, upper_percentile, method)
501 image = rgb2gray(image)
502
--> 503 dlimits = dtype_limits(image, clip_negative=False)
504 limits = np.percentile(image, [lower_percentile, upper_percentile])
505 ratio = (limits[1] - limits[0]) / (dlimits[1] - dlimits[0])

C:\ProgramData\Anaconda3\lib\site-packages\skimage\util\dtype.py in dtype_limits(image, clip_negative)
47 warn('The default of clip_negative in skimage.util.dtype_limits '
48 'will change to False in version 0.15.')
---> 49 imin, imax = dtype_range[image.dtype.type]
50 if clip_negative:
51 imin = 0

KeyError: <class 'numpy.object_'>

The number of bounding boxes are larger than number of images.

In attempting to recreate the project exactly as described, in terms of downloading the exact same .csv files, I come across the following error when running

length of the images_boxable: 1743042
First image in images_boxable👇
image_name: e39871fd9fd74f55.jpg
img_url: https://requestor-proxy.figure-eight.com/figure_eight_datasets/open-images/train/e39871fd9fd74f55.jpg
length of the annotations_bbox: 14610229
The number of bounding boxes are larger than number of images.
length of the class_descriptions: 599

I am not sure how to proceed.

Thank You
Tom

How to load the annotation file

Thanks for the GitHub repository and easy use in colab. I want to train with my custom dataset. I have the annotations in txt format. I tried changing the file path in 'base_path' and 'train_path' to my path in the training notebook. But I got the following error. Maybe I assigned the path wrongly. Can you help me.
frcnn

Error in Preprocessing code

Hi

In preprocessing this cell

In [46]:
print(len(urls[0]))
print(urls[0][0])
print(saved_paths)

Should be this :

print(len(urls[0]))
print(urls[0][0])
print(saved_dirs)

ResourceExhaustedError during test phase in loading weights

Hi,
Thank you for your shared project!
I followed all the data preprocessing and training steps according to the corresponding 2 ipynb file. When I test it using your frcnn_test_vgg.ipynb, a ResourceExhaustedError accurred when I try to load weights from the trained model in the following steps:

print('Loading weights from {}'.format(C.model_path))
model_rpn.load_weights(C.model_path, by_name=True)
model_classifier.load_weights(C.model_path, by_name=True)

I used my own GPU (2 1080s) training the model, an the error is like:

Loading weights from Faster_RCNN/model/model_frcnn_vgg.hdf5


ResourceExhaustedError Traceback (most recent call last)
~/.conda/envs/frcnn/lib/python3.6/site-packages/tensorflow/python/client/session.py in _do_call(self, fn, *args)
1333 try:
-> 1334 return fn(*args)
1335 except errors.OpError as e:

~/.conda/envs/frcnn/lib/python3.6/site-packages/tensorflow/python/client/session.py in _run_fn(feed_dict, fetch_list, target_list, options, run_metadata)
1318 return self._call_tf_sessionrun(
-> 1319 options, feed_dict, fetch_list, target_list, run_metadata)
1320

~/.conda/envs/frcnn/lib/python3.6/site-packages/tensorflow/python/client/session.py in _call_tf_sessionrun(self, options, feed_dict, fetch_list, target_list, run_metadata)
1406 self._session, options, feed_dict, fetch_list, target_list,
-> 1407 run_metadata)
1408

ResourceExhaustedError: OOM when allocating tensor of shape [] and type float
[[{{node block1_conv1_12/random_uniform/sub}} = Constdtype=DT_FLOAT, value=Tensor<type: float shape: [] values: 0.199501872>, _device="/job:localhost/replica:0/task:0/device:GPU:0"]]

During handling of the above exception, another exception occurred:

ResourceExhaustedError Traceback (most recent call last)
in
23
24 print('Loading weights from {}'.format(C.model_path))
---> 25 model_rpn.load_weights(C.model_path, by_name=True)
26 model_classifier.load_weights(C.model_path, by_name=True)
27
.
.
.
.
.
.
ResourceExhaustedError: OOM when allocating tensor of shape [] and type float
[[node block1_conv1_12/random_uniform/sub (defined at /home/fed14002/.conda/envs/frcnn/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py:4139) = Constdtype=DT_FLOAT, value=Tensor<type: float shape: [] values: 0.199501872>, _device="/job:localhost/replica:0/task:0/device:GPU:0"]]
.
.
.
.
ResourceExhaustedError (see above for traceback): OOM when allocating tensor of shape [] and type float
[[node block1_conv1_12/random_uniform/sub (defined at /home/fed/.conda/envs/frcnn/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py:4139) = Constdtype=DT_FLOAT, value=Tensor<type: float shape: [] values: 0.199501872>, _device="/job:localhost/replica:0/task:0/device:GPU:0"]]

I searched online that for such kind of error, typically people reduced the batch size to fit into the memory. But for the test phase, I can't see any batch size configuration in loading weights.

Thanks a lot!

Do training for graphs also require ImageNet dataset

Hi @RockyXu66 ,read your article on medium,it was amazing
I have a doubt that you wanted to detect realtime objects so you trained your model on ImageNet;But I want to detect patterns in graphs,so even I need to initialize my model with ImageNet dataet and apply transfer learning,and then train this models on graphs and and predict output?
Or should I create new model consisting of only labelled images of graphs I want to classify and not preinitialized images on ImageNet?

Validation set

Hey guys I almost got the code working. But now I'm wondering where you can put in the validation set. Or does the code just takes some random samples from the training set and makes them the validation set?

Thanks

Incorrect assumption of the rpn_layer dimension in rpn_to_roi() method

In the rpn_to_roi() method the shape of rpn_layer is assumed to be of (1, 18, 25, 18) dimension whereas it actually is (1, 18, 25, 9). The last dimension is incorrectly assumed as 18(no of channels) ,which can also be crosschecked by printing rpn_layer.shape[3] value, which in my case is 9 (num_anchors) and for valid below mentioned reasons.

  • If we trace back the code then the value of rpn_layer argument is P_rpn[0] which is the first value of the predicted rpn from the rpn model, coming from this line

    P_rpn = model_rpn.predict_on_batch(X)

  • Again the shape of P_rpn[0] when printed is (1, 28, 18, 9)

  • Now model_rpn when evaluated has the output layer as the rpn_layer

    model_rpn = Model(img_input, rpn[:2])

    which is initialised in rpn_layer() method

    rpn = rpn_layer(shared_layers, num_anchors)

  • Now following the code of rpn_layer() method, we can clearly see that the no of output channels is of num_anchors dimensions (which is 9).

    x_class = Conv2D(num_anchors, (1, 1), activation='sigmoid', kernel_initializer='uniform', name='rpn_out_class')(x)

  • So assuming that the shape of the predicted output is of (1, 18, 25, 18) dimension is incorrect in determining the no of channels, as the actual no of channels is 9(num_anchors), which one can also crosscheck by printing its shape.

  • I have followed the exact steps as in the article and the model got completely trained with no glitch in the code. If someone gets 18 as the no of channels then please let me know.

Positive anchors are not good

Hi everyone,

When I look the result of the RPN, positive anchors have not the IoU required as in the config : 0.7. Even in the tutorial, in the the part "Explore 'data_gen_train", I think positive anchor generated with the rpn have not an IoU of 0.7 with the car.
Maybe I undestand something wrong or i missed something.
Someone can explain to me ?

bounding boxes are not drawn in the testing image ,please give me the solution

for ii in range(P_cls.shape[1]):
# Ignore 'bg' class
if np.max(P_cls[0, ii, :]) < bbox_threshold or np.argmax(P_cls[0, ii, :]) == (P_cls.shape[2] - 1):
continue

################################################################################

The loop was stopped at that "continue" and The testing model was not giving the bounding boxes on that particular image.. so please any ]one solve this problem.

here i given 20 epochs and 1000 epoch length to the testing model and then i am going to testing but its cant work.
Thanking You !

calculate anchors for RPN

in these lines 530, 531, you add 0.5 to ix. I don't understand why, could you please explain this point.
x1_anc = downscale * (ix + 0.5) - anchor_x / 2
x2_anc = downscale * (ix + 0.5) + anchor_x / 2

Results

Sorry was a stupid question ;)

Where are record.csv? How to generate this file?

Hello ,

Im newbie in python i understand a little but not all.

I need this file(record.csv) for finish the test notebook( i saw all the notebook and i dont see anything so i answer here if someone have this file or know how to generate). I also need the records.csv because i think that this file is the exportation of pickle that use in the test notebook or something like that.

record_path = base_path +'/model/record.csv' # Test data (annotation file)
test_base_path = base_path + '/test' # Directory to save the test images

config_output_filename = os.path.join(base_path, 'model_vgg_config.pickle')

with open(config_output_filename, 'rb') as f_in:
	C = pickle.load(f_in)

# turn off any data augmentation at test time
C.use_horizontal_flips = False
C.use_vertical_flips = False
C.rot_90 = False


record_df = pd.read_csv(C.record_path)

r_epochs = len(record_df)

plt.figure(figsize=(15,5))
plt.subplot(1,2,1)
plt.plot(np.arange(0, r_epochs), record_df['mean_overlapping_bboxes'], 'r')
plt.title('mean_overlapping_bboxes')

plt.subplot(1,2,2)
plt.plot(np.arange(0, r_epochs), record_df['class_acc'], 'r')
plt.title('class_acc')

plt.show()

plt.figure(figsize=(15,5))

plt.subplot(1,2,1)
plt.plot(np.arange(0, r_epochs), record_df['loss_rpn_cls'], 'r')
plt.title('loss_rpn_cls')

plt.subplot(1,2,2)
plt.plot(np.arange(0, r_epochs), record_df['loss_rpn_regr'], 'r')
plt.title('loss_rpn_regr')
plt.show()
plt.figure(figsize=(15,5))
plt.subplot(1,2,1)
plt.plot(np.arange(0, r_epochs), record_df['loss_class_cls'], 'r')
plt.title('loss_class_cls')

plt.subplot(1,2,2)
plt.plot(np.arange(0, r_epochs), record_df['loss_class_regr'], 'r')
plt.title('loss_class_regr')
plt.show()
plt.figure(figsize=(15,5))
plt.subplot(1,2,1)
plt.plot(np.arange(0, r_epochs), record_df['curr_loss'], 'r')
plt.title('total_loss')

plt.subplot(1,2,2)
plt.plot(np.arange(0, r_epochs), record_df['elapsed_time'], 'r')
plt.title('elapsed_time')

plt.show()

I generate all files that i need but in these cases arent generated.

Summary:
i need record.csv.

Greetings @dherediat97 and Regards

Anchor Scales.

I am unable to understand the use of self.anchor_box_scales = [64, 128, 256] in the implemenation. Can anyone explain it?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.