facebookresearch / facebookresearch/detectron2

Raise error "RPN requires gt_instances in training" when training with unlabeled images.

Open
#4,437 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
34.7k
Forks
7.9k
PR merge metrics
No merged PRs in 30d

Description

Hello
i am trying to add unlabeled images when training maskrcnn, i have added "annotations" as a empty list and set "cfg.DATALOADER.FILTER_EMPTY_ANNOTATIONS = False". finally i got the error "RPN requires gt_instances in training" .
am i doing a wrong way to put unlabeled images involving the training? if someone help me out , thanks in advance.

#############My environment:

![1](https://user-images.githubusercontent.com/85349824/181462989-54e61db7-1de9-4842-851a-284f7eef8156.png)

############# Instructions To Reproduce the Issue:
1、my oraginal json file like this one(only have images with labels):

![2](https://user-images.githubusercontent.com/85349824/181463311-216c8f3e-c273-4e6e-b712-9bba60ad120e.png)

2、then i add unlabeled images's id,height....at "images" part in step one json file, the "annotation" part in this step are not changed.

![3](https://user-images.githubusercontent.com/85349824/181463582-d2e44471-1452-45af-bbfb-c3e7bcd34ad4.png)

ps: my trian data file as below:
![9](https://user-images.githubusercontent.com/85349824/181465365-126a2903-f6b1-4a39-aae8-4fefa57e2ce0.png)
![10](https://user-images.githubusercontent.com/85349824/181465377-43e56dec-aa93-4369-852f-455fc5c0d5df.png)

3、after that i change the load_coco_json function in coco.py to allow "annotation" has empty list for unlabeles images when register my train data:

register part in my train.py

![4](https://user-images.githubusercontent.com/85349824/181464252-ea946950-c9ec-47d9-b51a-6c1009dffb58.png)

rewrite load_coco_json function in coco.py to allow "annotation" has empty list for unlabeles images

![5](https://user-images.githubusercontent.com/85349824/181464545-a9c082c8-dd72-48b5-83e0-2602921c6167.png)

4、then i find in data_mapper.py needs recompute boxes, and the unlabed images have not gt_masks and gt_boxes. thus i changed recompute boxes part and mute filter_empty_instances( ) function which shows below:

![6](https://user-images.githubusercontent.com/85349824/181465056-462cc208-f870-43c8-88db-46092f9b1bb6.png)

5、finally, i set "cfg.DATALOADER.FILTER_EMPTY_ANNOTATIONS = False"

6、when i am training ,the output as below:

![7](https://user-images.githubusercontent.com/85349824/181465124-10fc561c-67c0-4932-adf6-83e470e2a7f5.png)

![8](https://user-images.githubusercontent.com/85349824/181465141-5cb196e0-4ef9-4256-b061-26901ca93a4b.png)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.