bnsreenu / python_for_microscopists

https://www.youtube.com/channel/UC34rW-HtPJulxr5wp2Xa04w?sub_confirmation=1
MIT License
3.78k stars 2.35k forks source link

In 331_fine_tune_SAM_mito.ipynb, the class SAMDataset(Dataset) needs to be adjusted to have 3 bands to go into the processor #81

Open throughthetrees opened 4 months ago

throughthetrees commented 4 months ago

The demo no longer works.

Change this line in the class SAMDataset(Dataset)

# prepare image and prompt for the model inputs = self.processor(image, input_boxes=[[prompt]], return_tensors="pt")

to

# prepare image and prompt for the model inputs = self.processor(np.stack((image,)*3, axis=-1), input_boxes=[[prompt]], return_tensors="pt")

ZoreAnuj commented 4 months ago

Thanks man!

VaishnaviMudaliar commented 4 months ago

I spent a week trying to figure this out. Thanks for the solution!

RoyAn2386 commented 4 months ago

Thanks man~~

ajaidevanath commented 2 months ago

Still having issues

ajaidevanath commented 2 months ago

ERROR:"setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (2,) + inhomogeneous part"