prabhakar-sivanesan / Custom-keypoint-detection

Custom keypoint detection using Tensorflow object detection API
https://prabhakar-sivanesan.github.io/me/
45 stars 6 forks source link

Invalid Argument Error "Input to reshape is a tensor with 76 values, but the requested shape requires a multiple of 6" #4

Open igorlacroix opened 1 year ago

igorlacroix commented 1 year ago

Dear Prabhakar,

Thank you for your "Custom Keypoint Detection" tutorial, it's very helpful!

I could follow most of the steps from the annotation process until the generation of TFrecord, but when I ran the training step I couldn't go further. The script presented the following error: tensorflow.python.framework.errors_impl.InvalidArgumentError: {{function_node wrappedIteratorGetNext_output_types_19device/job:localhost/replica:0/task:0/device:GPU:0}} Input to reshape is a tensor with 76 values, but the requested shape requires a multiple of 6 [[{{node Reshape_8}}]] [[MultiDeviceIteratorGetNextFromShard]] [[RemoteCall]] [Op:IteratorGetNext]

I annotated 60 512x512 floor plan images with 3 categories, wall corner, door and window, each category with only one keypoint. There's an average of 50 annotations per image. I'm using Colab with standard GPU for CenterNet HourGlass 104 512x512. I couldn't work with the splitting script for the JSON annotations, so I splitted them manually for training and validation. When I generated the TFrecord, the generate_tfrecord_from_coco.py script created the train.record and val.record files, but it presented the following error: File "/content/gdrive/MyDrive/projects/custom_keypoint_detection/dataset/generate_tfrecord_from_coco.py", line 242, in create_tf_example keypoints = keypoint_annotations['keypoints'] KeyError: 'keypoints'

I've checked many Stack Overflow and Github questions about the issue from the subject, but none of them present specific solutions.

I keep myself available.

Best regards, Igor

benasmi commented 1 year ago

I'm having the same issue when training model on multiple classes and keypoints.

ensorflow.python.framework.errors_impl.InvalidArgumentError: {{function_node _wrapped__IteratorGetNext_output_types_19_device/job:localhost/replica:0/task:0/device:GPU:0}} Input to reshape is a tensor with 56 values, but the requested shape requires a multiple of 26 [[{{node Reshape_8}}]] [[MultiDeviceIteratorGetNextFromShard]] [[RemoteCall]] [Op:IteratorGetNext]

igorlacroix commented 1 year ago

Dear @pijoneris, Have you tried to train a model with a single class and keypoints? Did it work? Best, Igor

kangombec commented 6 months ago

I'm having the same issue when training model on multiple classes and keypoints.

ensorflow.python.framework.errors_impl.InvalidArgumentError: {{function_node _wrapped__IteratorGetNext_output_types_19_device/job:localhost/replica:0/task:0/device:GPU:0}} Input to reshape is a tensor with 56 values, but the requested shape requires a multiple of 26 [[{{node Reshape_8}}]] [[MultiDeviceIteratorGetNextFromShard]] [[RemoteCall]] [Op:IteratorGetNext]

Hi @benasmi did you manage to train on multiple class?

kangombec commented 6 months ago

I'm having the same issue when training model on multiple classes and keypoints. ensorflow.python.framework.errors_impl.InvalidArgumentError: {{function_node _wrapped__IteratorGetNext_output_types_19_device/job:localhost/replica:0/task:0/device:GPU:0}} Input to reshape is a tensor with 56 values, but the requested shape requires a multiple of 26 [[{{node Reshape_8}}]] [[MultiDeviceIteratorGetNextFromShard]] [[RemoteCall]] [Op:IteratorGetNext]

Hi @benasmi did you manage to train on multiple class?

If so how did you finally get to to train. I'am having the same issue as you.