HikariTJU / LD

Localization Distillation for Object Detection (CVPR 2022, TPAMI 2023)
Apache License 2.0
368 stars 52 forks source link

AP landscape #45

Open jwfanDL opened 2 years ago

jwfanDL commented 2 years ago

Exciting and excellent work! We are really interested in your AP landscape. Will you released the code or pseudo-code for testing AP landscape?

Zzh-tju commented 2 years ago

I can't access the server which has this part of code for the time being, but it will be released once I can. But I can provide some modification suggestions here.

First, you must modify tools/test.py so as to load two detectors. The relevant files are tools/test.py, the function multi_gpu_test() of mmdet/apis/test.py and the function simple_test() of mmdet/models/detectors/single_stage.py.

Then, if I remenber correctly, the main modifications are in the function simple_test() of mmdet/models/detectors/single_stage.py. And the most important part is line 112-113.

In L112, the variable x contains the 5 FPN output feature maps. And then x will be feed into the head networks in L113.

Suppose you have loaded two detectors here, you get x1 and x2 of two detectors. One should note that x is a tuple, it cannot be modified directly. So, you can transform x1, x2 to numpy arrays. And for each FPN level, i.e., x[0], x[1], ..., x[4] (totally 5 levels), you can do math transformation to get a new feature map x[i] = a*x1[i] + b*x2[i], where a,b\in[-0.5,1.5] in the paper. And then transform the numpy array x to a tuple so that it can be feed into L113 outs = self.bbox_head(x) to inference as usual.

Finally, wait the inferece and the evaluation process, you will get the evaluation measures and don't forget to save them.

As a reminder, the 2D AP landscape in the paper evaluates 400 times. It is time-consuming.

Zzh-tju commented 2 years ago

@JwFbupt updated, you can see readme. For any further question or bugs, please post here.