In the notebook on finetuning SegmentAnything, the following code (in Cell 11) throws an error:
example = train_dataset[0]
for k,v in example.items():
print(k,v.shape)
Here is the ValueError thrown:
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
[<ipython-input-29-8c49af5cb2d0>](https://localhost:8080/#) in <cell line: 7>()
5 prompt = get_bounding_box(ground_truth_mask)
6 print(prompt)
----> 7 inputs = train_dataset.processor(image, input_boxes=[prompt], return_tensors="pt")
1 frames
[/usr/local/lib/python3.10/dist-packages/transformers/models/sam/processing_sam.py](https://localhost:8080/#) in _check_and_preprocess_points(self, input_points, input_labels, input_boxes)
233 or not isinstance(input_boxes[0][0], list)
234 ):
--> 235 raise ValueError("Input boxes must be a list of list of list of floating integers.")
236 input_boxes = [np.array(box).astype(np.float32) for box in input_boxes]
237 else:
ValueError: Input boxes must be a list of list of list of floating integers.
Fix:
The fix would be to pass the input_boxes as a nested list in SamDataset. (In Cell 10)
Bug:
In the notebook on finetuning SegmentAnything, the following code (in Cell 11) throws an error:
Here is the
ValueError
thrown:Fix: The fix would be to pass the
input_boxes
as a nested list inSamDataset
. (In Cell 10)