minus31 / BlazeFace

Implementating BlazeFace

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Output layer shape problem

aniketmaurya opened this issue · comments

The output layer for conf prediction is of shape (None, 896, 1) but my input label shape is (BATCH_SIZE, 1).
I am getting a shape mismatch error here.

Traceback (most recent call last): File "main.py", line 156, in <module> blazeface.train() File "main.py", line 123, in train use_multiprocessing=True) File "/Users/aniketmaurya/miniconda3/envs/tf2/lib/python3.6/site-packages/tensorflow_core/python/keras/engine/training.py", line 1303, in fit_generator steps_name='steps_per_epoch') File "/Users/aniketmaurya/miniconda3/envs/tf2/lib/python3.6/site-packages/tensorflow_core/python/keras/engine/training_generator.py", line 265, in model_iteration batch_outs = batch_function(*batch_data) File "/Users/aniketmaurya/miniconda3/envs/tf2/lib/python3.6/site-packages/tensorflow_core/python/keras/engine/training.py", line 979, in train_on_batch class_weight=class_weight, reset_metrics=reset_metrics) File "/Users/aniketmaurya/miniconda3/envs/tf2/lib/python3.6/site-packages/tensorflow_core/python/keras/engine/training_v2_utils.py", line 253, in train_on_batch extract_tensors_from_dataset=True) File "/Users/aniketmaurya/miniconda3/envs/tf2/lib/python3.6/site-packages/tensorflow_core/python/keras/engine/training.py", line 2503, in _standardize_user_data y, self._feed_loss_fns, feed_output_shapes) File "/Users/aniketmaurya/miniconda3/envs/tf2/lib/python3.6/site-packages/tensorflow_core/python/keras/engine/training_utils.py", line 742, in check_loss_and_target_compatibility ' while using as loss ' + loss_name + '`. '

ValueError: A target array with shape (1, 13, 1) was passed for an output of shape (None, 896, 1) while using as loss binary_crossentropy.
This loss expects targets to have the same shape as the output.`

commented

The output for the confidence values, which mean that there is an object or not, are allocated to each bounding boxes. So, Your input label shaped (BATCH_SIZE, 1) is confusing me.