PKU-ICST-MIPL / DRLIH_TMM2020

3 stars 3 forks source link

An error! #4

Open burhanbarakli opened 2 years ago

burhanbarakli commented 2 years ago

in below code in test_util.py, list.sort(cmp) gives an error for list arguments! Is it necessary sorting ? Can i change it to comment line.

And the other question is when does the Train end? Because in train.py while condition is true, it goes infinity! So how many episode run for article results?

When should the while loop terminate? Because every 10000 episodes low_lr function works.

In short, according to your experience, how many episodes do I have to try?

Thanks for response!

def cmp(a,b):
    if a[0]==b[0]:
        return 0
    if a[0]>b[0]:
        return 1
    if a[0]<b[0]:
        return -1

def get_map(query,data,query_lab,data_lab):
    tot = 0
    print 
    for i in range(len(query)):
        list = []
        eletot = 0.0
        cnt = 0
        for j in range(len(data)):
            list .append(  (calc(query[i],data[j]),data_lab[j])  )
        list.sort(cmp)  ##########################################This code gives error

        for j in range(len(list)):
            if list[j][1]==query_lab[i]:
                cnt += 1
                eletot += cnt*1.0/(1.0+j)
        eletot /= cnt
#       print list
#       print eletot
        tot += eletot
    tot /= len(query)
    return tot
magicfisk commented 2 years ago

this code is runing with python 2.7, the code might gives errors with pyrhon 3.

in our experiment, the best performance is 30,000-40,000 episodes on cifar dateset.

chj123456789 commented 2 years ago

请问函数cmp的作用是?我在运行时将它删除了,导致我测试时map总是很低

magicfisk commented 2 years ago

您好。cmp是比较函数,用于对检索结果的排序。list中保存了相似度和标签。cmp读取相似度进行比较

删除后会导致返回的结果错误,因此测试的map也不正确

chj123456789 commented 2 years ago

您好,我使用的是python3.6,按道理list.sort就可以返回汉明距离的排序结果,请问cmp读取的相似度指的是?

burhanbarakli commented 2 years ago

this code is runing with python 2.7, the code might gives errors with pyrhon 3.

in our experiment, the best performance is 30,000-40,000 episodes on cifar dateset.

and

您好。cmp是比较函数,用于对检索结果的排序。list中保存了相似度和标签。cmp读取相似度进行比较 删除后会导致返回的结果错误,因此测试的map也不正确 i also translated this comment to english!

Hello. cmp is a comparison function, used to sort the search results. The similarity and label are saved in the list.cmp read similarity for comparison After deleting, the returned result will be wrong, so the tested map is not correct

### so i understood the list.sort(cmp) is a necessary code line? am i right?

magicfisk commented 2 years ago

Yes!

Thanks for your attention. We will release a new code to fit python3 and provide the organized dataset with the pre-trained model in 2-3 days. I hope it can help you to better understand our paper.

burhanbarakli commented 2 years ago

Yes!

Thanks for your attention. We will release a new code to fit python3 and provide the organized dataset with the pre-trained model in 2-3 days. I hope it can help you to better understand our paper.

Thank you very much. I will wait new python 3 codes for your paper.