Open roboyul opened 8 months ago
Hello,
Some points I would try to check :
Hope this helps !
Thank you for the prompt reply @TariqBerrada! Looks like it was related to your last two points. After reviewing and ensuring my metadata is properly configured for my custom set, the validation metrics are as expected.
As a follow up, is there an inference script example available, or should I follow standard M2F/D2 inference for these models?
Ignoring custom datasets for now, I trained the Teacher
model as per the README on the COCO dataset and grabbed a checkpoint that evaled at around 20 AP. I wanted to run inference just to visually see how the Teacher model is performing on its predictions before I continue with second step.
I'm using Mask2Former's demo.py
to test inference and added the add_ssl_config(cfg)
line to properly load the output config from the teacher model:
python3 demo.py --config-file ./output-teacher/config.yaml --input test.jpg --opts MODEL.WEIGHTS ./output-teacher/model_best.pth TEST.DETECTIONS_PER_IMAGE 5
But the results are not what I would expect even though the validation results appear promising. Almost like it's inferencing against untrained weights or something? I would expect a roughly accurate mask around some of the objects and perhaps miscategorized like the top half of illustrations/coco_illustration.png
, but it's quite worse than that (nearly full-image and very noisy masks, always completely different preds). Here's an example from COCO's test2017
:
1 detection for testing: https://github.com/facebookresearch/GuidedDistillation/assets/161990216/7c57684c-e709-4c60-8c21-a276baa06a58 https://github.com/facebookresearch/GuidedDistillation/assets/161990216/65cf7ff9-5787-4f3a-9345-e6af38f77693 100 detections: https://github.com/facebookresearch/GuidedDistillation/assets/161990216/6b75e163-790b-4618-b2d2-646d3aa6b9ce
Am I misunderstanding how to test this Teacher model, or am I simply just loading the model incorrectly? Is the Teacher model not designed to output the instance predictions for this use? I'm rather new to this teacher/student system so thank you for your time and patience!
I met the same problem. I finally solved it by commenting lines 406-409 in the file "modules/defaults.py" and changing the content in the line 413 from checkp to model. You can have a try.
Hi there, thank you so much for putting this repository together for this implementation, it's very interesting!
I'm working on implementing this with a custom COCO instances formatted dataset rather than the original COCO 2017 instances dataset. I did an initial test run using the original COCO dataset, and was able to see the validation segm AP results gradually begin to increase as expected in as little as 500 iterations with a batch size of 2 for a quick test:
python3 -W ignore train_net.py --config-file ./configs/coco/instance-segmentation/deit/maskformer2_deit_base_bs16_50ep.yaml --num-gpus 2 --num-machines 1 SSL.PERCENTAGE 100 SSL.TRAIN_SSL False OUTPUT_DIR ./output-teacher
My problems arise when I begin integrating my custom dataset. I am able to successfully register my training/test set using
register_coco_instances
fromdata.datasets
>coco.py
. I then update the configuration accordingly:Inside the
coco_unlabel
folder, I create the symlinks for theimages
folder pointing to my training images folder and the symlink for theval2017
folder to my validation set as per the instructions. I pointDETECTRON2_DATASETS
to the location wherecoco_unlabel
lives, and it appears to pick it up.Up to here, everything works fine. The training job starts using:
python3 -W ignore train_net.py --config-file ./configs/coco/instance-segmentation/deit/maskformer2_deit_base_bs16_50ep.yaml --num-gpus 2 --num-machines 1 SSL.PERCENTAGE 100 SSL.TRAIN_SSL False OUTPUT_DIR ./output-teacher
When the training job attempts to do the first evaluation step (set to 500 for testing), an error shows explaining my test set doesn't appear to be registeredm even though it picked up the training set:
If I register the test set with
detectron2.data.datasets
instead ofdata.datasets
, the evaluation works, but the AP values are always 0 no matter how long the job runs:Am I missing something here? I'm assuming its related to registering my datasets, as the original COCO dataset implementation from the guide appears to work. I've also made sure to update the
NUM_CLASSES
field across the config according to the classes available in my custom dataset. I've also tried the Dino/R50 bases as well with no luck. Thank you!