-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes required to run experiments #3
base: master
Are you sure you want to change the base?
Conversation
Differential test of Domain Adaptation module:For reference, to make sure that these modifications didn't ruin the underlying model's performance (i.e. without the domain adaptation turned on durinng training time) I have evaluated the score on the training data DOMAIN_ADAPTATION_ON: False
DOMAIN_ADAPTATION_ON: True
Conclusion
|
@botcs Thanks for your testing! Unfortunately I'm busy with another project now and I cannot test your changes in the future weeks. Your training loss seems normal. However, your performance on target domain with/without domain adaptation both look weird. As stated in the original paper, even with a VGG16 backbone, the network without adaptation could still achieve 30.12 car AP@50 on sim10k->cityscapes tasks. So I think the problems might be:
I will review your change as soon as I complete my current project. Thanks for your patience. If you are interested, here is my training log for sim10k->cityscapes car detection with domain adaptation. Hope it can help you to find what might be going wrong. |
I downloaded the dataset from the original sources and used the provided conversion scripts. The correctness of the converted dataset is indicated by the case when the domain adaptation head was turned off. I can also evaluate the model using the cityscapes as training dataset, or I can visualize the dataset with the annotations but I believe that the labels are correct.
No, apparently it's not. All syntax differences had been resolved, the only minor difference from PyTorch 1.0 and 1.3 is caused by the LR scheduler, but that's negligible. The code-base functions properly when the domain adaptation head is turned off or the lambda parameters are set to 0.
Could you please upload the complete log file? This log stops at 40840 iterations. Also if you could upload the checkpoint file as well for the trained model it would be great! Thanks, |
I'm still doubtful about it......Would you mind sharing your annotation files to me via email? Just in case you didn't realize it, the Cityscapes conversion scripts in this repo would generate a json file with 9 classes(including background) and class car would be mapped to class 3. For Sim10k->Cityscapes car detection task, you should generate a json file with only 2 classes(class 0 for background and class 1 for car) for both datasets. If your annotations are correct, then things will be tricky and I will have to reproduce your problems first to understand what might be going wrong.
Actually, the log file is complete. Github Gist will truncate large file for viewing. You could check the complete file by downloading it.
You could find the final checkpoint here. |
That is not the case. Following instructions from the README:
In Detectron-DA-Faster-RCNN the usage example is covering the sim10k -> cityscapes adaptation case. In that repository, there are two specific converter scripts, Minor issue is the following: using
I have also inspected the
|
I've investigated the counts of instances in the converted COCO format json. The two scripts are functioning differently.
with the the former conversion script, using the provided weight file the scores are: Compared to the results in the provided log file were: I would assume that this difference in performance is due to the implementation artifact with +1s around the edges are coming from Detectron. I will check it out soon. |
So after adding +1 to the W and H parameters of the boxes, the results are the same: After training the network locally using the corresponding sim10k config file, the scores are the following: What I'm really curious about is the following: why did the performance drop on the source domain when the domain adaptation was turned on? |
@botcs Sorry for the late reply. I have checked your annotations and find that you were using xyxy mode instead of xywh mode for cityscapes_caronly annotations (and xywh mode for sim10k annotations). You said that you generated this file using the conversion code in Detectron-DA-Faster-RCNN, but I run the same code and get a json file with xywh mode. Could you tell me how do you get the conversion code in your commit? It seems that your weird results are caused by xyxy mode in your annotation. After changing the annotations, could you achieve the similar performance as reported in the paper? I think this PR contains too many discussions unrelated to the original topic now. If you have any further questions, could you consider to open new issues? I think it would also benefit others who might be interested. Thanks for your experiments! |
I agree. What separate issues can you think of? My idea would be investigating the following:
|
@botcs Sorry for the late reply and thank you for your patience. Now I think I have time to discuss with you.
I totally agree with you. A conversion code will be released soon.
Adversarial training is very unstable. It's quite normal that the performance of your final checkpoints in different trials vary a lot and the best performance is obtained before the training stop. As far as I know, there is still not an effective and robust method to stabilize the adversarial training. So here's my suggestions:
I run the checkpoint on my generated annotation file again and get the same results. I think the difference might come from the different annotation file. As I mentioned above, I would share a conversion code ASAP.
Seeing from now I agree it was unnecessary. However, when I began to develop this repo, I assumed maskrcnn_benchmark is designed as a base framework for further instance segmentation/panoptic segmentation algorithms. I was worried that adding new features might change the APIs and it would be difficult to incorporate new commits from the maskrcnn_benchmark because you have to distinguish whether these commits have any conflicts with the old code. Now with the advent of (detectron2)[https://github.com/facebookresearch/detectron2], I think there won't be large change for the maskrcnn_benchmark in the future. I would consider to update this repo to a latest stable version of maskrcnn_benchmark, but I have to admit that I would not put a high priority to it.
I have avoided any calling for the target domain labels in the implementation. Plus, I generate an annotation file by assigning a fake bbox with the size (0, 0, image_width, image_height) to each image as the target domain training samples and get a 40.2 mAP@50 finally. |
I have evaluated the model every 100 iterations and got this result:
I was just using this method, but it's good to know that there's a study about it. Thank you!
While in the DA heads definition annotations are optional, in loss definition annotations are a hard requirement.
I did not fully understand this part. Can you put it in another way? |
I filter out the target data loss computation at Domain-Adaptive-Faster-RCNN-PyTorch/maskrcnn_benchmark/modeling/rpn/loss.py Lines 64 to 65 in fe0d305
Domain-Adaptive-Faster-RCNN-PyTorch/maskrcnn_benchmark/modeling/roi_heads/box_head/loss.py Lines 193 to 196 in fe0d305
The reason I need target annotation variable in the detection network is that I use it to store domain labels. I admit it's confusing and I am considering to improve it. |
thanks, that's really helpful to know. Could you please also explain why do you do permutations here? Domain-Adaptive-Faster-RCNN-PyTorch/maskrcnn_benchmark/modeling/da_heads/loss.py Lines 70 to 75 in fe0d305
|
also here I think the concatenation has to be carried out on dim=1 (after flattening) Domain-Adaptive-Faster-RCNN-PyTorch/maskrcnn_benchmark/modeling/da_heads/loss.py Lines 80 to 81 in fe0d305
Because otherwise you would have different length vectors for different sizes after flattening (one at each backbone stage), e.g.:
This issue may not have come up before because in your config files FPN is turned off. Is it correct? |
Hi @krumo @yuhuayc ,
A few modifications and fixes were required to be able to run the
tools/train_net.py
with the provided config files - mostly just syntax updates, detectron dependency removals, and conversion script copying.The aim was to change nothing crucial that could alter the outcome of the experiments.
after following the instructions for the sim10k -> cityscapes experiment, running the
configs/da_faster_rcnn/e2e_da_faster_rcnn_R_50_C4_sim10k.yaml
resulted in the following scores:bbox: ('AP', 2.7570837762239852e-05), ('AP50', 0.00010808941156124346), ('AP75', 0.0) ...
the log file can be found here
Thank you for your time,
Csabi