-
Notifications
You must be signed in to change notification settings - Fork 2.5k
How to use a different amount of classes? (tried to look at other issues) #273
Comments
Hi, Are you training your model from one of COCO pre-trained models or just from ImageNet? The error you are having usually happens because your dataset is outputting a larger index than what you specified in From a quick look at your class mapping, it looks like you assign index 2 to number 3, is that right?
This might mean that your datasets are returning labels Could you check that and report back? |
Hi @fmassa, thanks for the response. Perhaps I misunderstood the
The difference from Also: I double-checked my preprocessing code: I only ever return the category ids 0, 1, or 2 |
Yup, that seems to be the issue. Once I removed the [0], the error went away. Dumb mistake on my part, apologies! |
Cool. great that you managed to fix the issue! |
@fmassa I am running into the same issue "RuntimeError: copy_if failed to synchronize: device-side assert triggered". I have my dataset with 4 classes in COCO format and I have edited the Checkpointer class as in #166 as well I have set the ROI_BOX_HEAD.NUM_CLASSES to 4. The output of my What am I missing? Is it not needed to set the ROI_BOX_HEAD.NUM_CLASSES to 4? when I don't set that training works. Thanks in advanced!
|
@adrifloresm looks like your indices goes up to 4 for the labels? I believe they should be from 0-3 if you have 4 classes (counting background). |
@fmassa thank you for your response. Indeed my issue was that I did not know I had to count the background class for the config setting, so "ROI_BOX_HEAD.NUM_CLASSES" had to be 5. I also had the mistake of not deleting the previous checkpoint (deleting the output folder after testing with 81 classes), so it was loading that, instead of creating a new one. Thanks for the help! |
@fmassa Hi!I have a question about how to label the background annotation (or negative sample) when creating the COCO format data set. For example, suppose that I have a medical image without any mask, so it should belong to the background during the training, i.e. its 'segmentation' is [ ] (empty), 'area' is 0, and 'bbox' is [0,0,0,0]. When labeling the categories for the annotations of all images, I assign the postive samples to class 1 (i.e., the category id is 1), the negative samples to class 0, but during the training I need to modify the |
@BobZhangHT does this issue #169 addresses your question? if you don't have any label in an image, and if the patch from #169 works, then just just need to modify the |
Sincerely thanks for your suggestion! : ) |
❓ Questions and Help
Hi there, I've been trying to get the repo to work with a new dataset (DDSM - mammography data), and I believe I'm close, but the final step is to actually use the correct amount of classes. I've modified the dataset to resemble the structure of COCO.
In the DDSM dataset, there are three classes (background, benign, and malignant). In order to try to get it to work, I followed the example in #166 (changed
ROI_BOX_HEAD.NUM_CLASSES
to 3 and modified theCheckpointer
class). However, I'm still getting the following error:I've tried looking at #15 and other issues and quite frankly I'm still lost as to what's the right procedure for having a different amount of classes. What am I missing? What else do I need to do?
If it's any help, this is my config file:
Thank you so much in advance.
The text was updated successfully, but these errors were encountered: