You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am generating the mask by SAM2AutomaticMaskGenerator. I use the code that I wrote before and it works well. The only change is that it is the new model that I train it with differnt resolusion(the default is 1024, and I cahge it to 512). Then, there is a image that always shows the error (error messege bellow). And I find out, after the function '_generate_masks' done the for loop (232:235, automatic_mask_generator.py) makes the variable data["crop_boxes"] to the shape equal to zero and it crash the program.
Traceback (most recent call last):
File "/sam2/predict-tmp.py", line 372, in<module>main()
File "/sam2/predict-tmp.py", line 342, in main
masks = mask_generator.generate(image)
File "/opt/conda/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "/sam2/sam2/automatic_mask_generator.py", line 196, in generate
mask_data = self._generate_masks(image)
File "/sam2/sam2/automatic_mask_generator.py", line 242, in _generate_masks
scores = 1 / box_area(data["crop_boxes"])
File "/opt/conda/lib/python3.10/site-packages/torchvision/ops/boxes.py", line 251, in box_area
return (boxes[:, 2] - boxes[:, 0]) * (boxes[:, 3] - boxes[:, 1])
IndexError: too many indices for tensor of dimension 1
I am wondering why is that happening. Before I change the resolusion to 512, the code run perfectly.
The text was updated successfully, but these errors were encountered:
I am generating the mask by SAM2AutomaticMaskGenerator. I use the code that I wrote before and it works well. The only change is that it is the new model that I train it with differnt resolusion(the default is 1024, and I cahge it to 512). Then, there is a image that always shows the error (error messege bellow). And I find out, after the function '_generate_masks' done the for loop (232:235, automatic_mask_generator.py) makes the variable data["crop_boxes"] to the shape equal to zero and it crash the program.
I am wondering why is that happening. Before I change the resolusion to 512, the code run perfectly.
The text was updated successfully, but these errors were encountered: