layumi / University1652-Baseline

ACM Multimedia2020 University-1652: A Multi-view Multi-source Benchmark for Drone-based Geo-localization :helicopter: annotates 1652 buildings in 72 universities around the world.
https://arxiv.org/abs/2002.12186
MIT License
484 stars 72 forks source link

Testing Drone -> satellite with views=2 is not defined but is default settings #12

Closed jpainam closed 3 years ago

jpainam commented 3 years ago

Hi. I trained using the tutorial readme with this command. python train.py --gpu_ids 0,2 --name ft_ResNet50 --train_all --batchsize 32 --data_dir /home/xx/datasets/University-Release/train And this is the generated yaml

DA: false
batchsize: 32
color_jitter: false
data_dir: /home/paul/datasets/University-Release/train
droprate: 0.5
erasing_p: 0
extra_Google: false
fp16: false
gpu_ids: 0,2
h: 384
lr: 0.01
moving_avg: 1.0
name: ft_ResNet50
nclasses: 701
pad: 10
pool: avg
resume: false
share: false
stride: 2
train_all: true
use_NAS: false
use_dense: false
views: 2
w: 384
warm_epoch: 0

So, for testing, i do this python test.py --gpu_ids 0 --name ft_ResNet50 --test_dir /home/xx/datasets/University-Release/test --batchsize 32 --which_epoch 119 I found out that, the views=2 and the view_index=3 in the extract_feature function. Using this code

def which_view(name):
    if 'satellite' in name:
        return 1
    elif 'street' in name:
        return 2
    elif 'drone' in name:
        return 3
    else:
        print('unknown view')
    return -1

The task is 3 -> 1 means Drone -> Satellite with views=2. But the code in the testing, doesn't consider this scenario

 for scale in ms:
    if scale != 1:
       # bicubic is only  available in pytorch>= 1.1
        input_img = nn.functional.interpolate(input_img, scale_factor=scale, mode='bilinear', align_corners=False)
        if opt.views ==2:
           if view_index == 1:
              outputs, _ = model(input_img, None) 
           elif view_index ==2:
               _, outputs = model(None, input_img) 
        elif opt.views ==3:
           if view_index == 1:
              outputs, _, _ = model(input_img, None, None)
           elif view_index ==2:
                _, outputs, _ = model(None, input_img, None)
            elif view_index ==3:
                    _, _, outputs = model(None, None, input_img)
                ff += outputs # Give error, since outputs is not defined

For views == 2, there is no views_index == 3

wtyhub commented 3 years ago

@jpainam opt.views=2 is used for training and testing CVUSA dataset, which only has satellite view and street view. If you want to train and test University-1652 using two views, you can set opt.views=3 and change the loss weight of street view to 0 when training. During testing, you can employ 3->1 to test the performance of Drone -> Satellite. The code can be seen https://github.com/layumi/University1652-Baseline/blob/master/train_no_street.py

image
jpainam commented 3 years ago

Thanks testing the task 3 -> 1 i.e. Drone -> Satellite gives me this result

Recall@1:61.51 Recall@5:81.48 Recall@10:86.79 Recall@top1:87.40 AP:66.02

Which is close to the one you reported in the paper. closing the issue