Thanks a lot for all the help.


I tired the code but having this error:
AttributeError: ‘bool’ object has no attribute ‘astype’ as shown in the first image.


I also downgraded numpy to version 1.17.4 but had the same error.


I am thinking, should I even try to print the object or try to get the values (img or target) from img, target = dataset_sample[7]?


From my understanding, this line of code


masks = mask == obj_ids[:, None, None]
turns multi-colored mask image into a True or False binary mask. And then uses this line:
pos = np.where(masks[i])
to do selection based on the boolean value.

I also did some reading on the np.where here: numpy.where — NumPy v1.19 Manual


and though np.where() uses 3 inputs I can’t relate it to the this:
pos = np.where(masks[i])
which seem to take in one value.

My thoughterror_image22456×1080 129 KB  is to finish the entire code and see if I can train the model, maybe I am thinking it too much by trying to see what the data is inside the return from:
img, target = dataset_sample[7].

Any suggestions? or help will be appreciated.
And I do really appreciate the all time taken to reply and help.
Thank you.