ssd_kerasV2
ssd_kerasV2 copied to clipboard
Prior files for training on new datasets
I am wondering if the prior files are general enough to use with any new datasets, or they are specifically used for a specific dataset?
prior files should be carefully made according to network size. I dont reccomend to change it. It's nothinng to do with datasets.
InvalidArgumentError: Incompatible shapes: [4,1917] vs. [4,1692] this problem is coming is mobilenet,VGG works fine
also in ssd300mobilenet.py in comments you say to have input shape of 300x300x3 but in code input shape used is 224x224x3.is there something to do with that ? shape of priors is (1917,8) which seems to be incompatible with input shape of data.can you please help what exactly problem is?
InvalidArgumentError Traceback (most recent call last)
~/anaconda3/envs/tf/lib/python3.6/site-packages/keras/legacy/interfaces.py in wrapper(*args, **kwargs)
89 warnings.warn('Update your ' + object_name + '
call to the ' +
90 'Keras 2 API: ' + signature, stacklevel=2)
---> 91 return func(*args, **kwargs)
92 wrapper._original_function = func
93 return wrapper
~/anaconda3/envs/tf/lib/python3.6/site-packages/keras/engine/training.py in fit_generator(self, generator, steps_per_epoch, epochs, verbose, callbacks, validation_data, validation_steps, class_weight, max_queue_size, workers, use_multiprocessing, shuffle, initial_epoch) 1416 use_multiprocessing=use_multiprocessing, 1417 shuffle=shuffle, -> 1418 initial_epoch=initial_epoch) 1419 1420 @interfaces.legacy_generator_methods_support
~/anaconda3/envs/tf/lib/python3.6/site-packages/keras/engine/training_generator.py in fit_generator(model, generator, steps_per_epoch, epochs, verbose, callbacks, validation_data, validation_steps, class_weight, max_queue_size, workers, use_multiprocessing, shuffle, initial_epoch) 215 outs = model.train_on_batch(x, y, 216 sample_weight=sample_weight, --> 217 class_weight=class_weight) 218 219 outs = to_list(outs)
~/anaconda3/envs/tf/lib/python3.6/site-packages/keras/engine/training.py in train_on_batch(self, x, y, sample_weight, class_weight) 1215 ins = x + y + sample_weights 1216 self._make_train_function() -> 1217 outputs = self.train_function(ins) 1218 return unpack_singleton(outputs) 1219
~/anaconda3/envs/tf/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py in call(self, inputs) 2713 return self._legacy_call(inputs) 2714 -> 2715 return self._call(inputs) 2716 else: 2717 if py_any(is_tensor(x) for x in inputs):
~/anaconda3/envs/tf/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py in _call(self, inputs) 2673 fetched = self._callable_fn(*array_vals, run_metadata=self.run_metadata) 2674 else: -> 2675 fetched = self._callable_fn(*array_vals) 2676 return fetched[:len(self.outputs)] 2677
~/anaconda3/envs/tf/lib/python3.6/site-packages/tensorflow/python/client/session.py in call(self, *args, **kwargs) 1437 ret = tf_session.TF_SessionRunCallable( 1438 self._session._session, self._handle, args, status, -> 1439 run_metadata_ptr) 1440 if run_metadata: 1441 proto_data = tf_session.TF_GetBuffer(run_metadata_ptr)
~/anaconda3/envs/tf/lib/python3.6/site-packages/tensorflow/python/framework/errors_impl.py in exit(self, type_arg, value_arg, traceback_arg) 526 None, None, 527 compat.as_text(c_api.TF_Message(self.status.status)), --> 528 c_api.TF_GetCode(self.status.status)) 529 # Delete the underlying status object from memory otherwise it stays alive 530 # as there is a reference to status from this from the traceback due to
InvalidArgumentError: Incompatible shapes: [4,1917] vs. [4,1692] [[{{node metrics/acc/Equal}} = Equal[T=DT_INT64, _device="/job:localhost/replica:0/task:0/device:GPU:0"](metrics/acc/ArgMax, metrics/acc/ArgMax_1)]] [[{{node loss/mul/_3011}} = _Recvclient_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device_incarnation=1, tensor_name="edge_13888_loss/mul", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"]]
Hi @yuvrajkhanna @tanakataiki
I'm facing the exact same issue as you, on my own dataset. Is there any solution you found for it? I would really appreciate some help, I've spent many days banging my head to no avail.
I forced the priors to be of shape 1692 by adding the following line in SSD_Train.ipynb, right after loading them from the pkl file:
priors = priors[:1692]
Now it is training. I'm not sure how the functionality will be affected. @tanakataiki can you help me out on this please?
change the inputs to the network as (300, 300, 3). These priors are specifically for images with size 300 x 300. There is no code provided to generate custom priors for a particular size of input image. So better to use the provided pickle file and resize input images to 300x300 and change inputs to (300,300,3)
Hello has anyone solved this? No matter what i do I get the error:
(0) Invalid argument: Incompatible shapes: [16,1917,4] vs. [16,1692,4] [[{{node loss/predictions_loss/compute_loss/sub}}]] [[metrics/acc/Identity/_2487]] (1) Invalid argument: Incompatible shapes: [16,1917,4] vs. [16,1692,4] [[{{node loss/predictions_loss/compute_loss/sub}}]]
I am running SSDMobilenet and my inputs to the network are definitely (300, 300, 3)
I solved the issue by changing the MobileNet input shape in SSD from (224, 224, 3) to (300, 300, 3).
Hi @shantanu-cashify , @yuvrajkhanna, @ImmyGO I met the exact same problem with Keras ver 2.2.4. I changed Keras version to 2.1.5 and it worked out.
I've modified the input shape in ssd300Mobilenet.py to be (300, 300, 3) but the issue is still there:
tensorflow.python.framework.errors_impl.InvalidArgumentError: Incompatible shapes: [1,1917,4] vs. [1,1692,4]
[[{{node loss/predictions_loss/sub}}]]
[[{{node loss/mul}}]]
Has anyone solved this?