swuxyj / DeepHash-pytorch

Implementation of Some Deep Hash Algorithms, Including DPSH、DSH、DHN、HashNet、DSDH、DTSH、DFH、GreedyHash、CSQ.
MIT License
495 stars 116 forks source link

Question about dataset #24

Closed Rayoll closed 2 years ago

Rayoll commented 2 years ago

If I have an image classification dataset, how could I get the onehot label of each image for retrieval?

swuxyj commented 2 years ago

I hope code1code2code3 can help you.

uniartisan commented 2 years ago

I hope code1code2code3 can help you.

Thanks a lot, it really help. Could you please tell me what does database.txt do in training the network :)

swuxyj commented 2 years ago

I hope code1code2code3 can help you.

Thanks a lot, it really help. Could you please tell me what does database.txt do in training the network :)

训练的时候只用了:train_loader test_loader, dataset_loader 在算mAP的时候用的:

            tst_binary, tst_label = compute_result(test_loader, net, device=device)

            # print("calculating dataset binary code.......")\
            trn_binary, trn_label = compute_result(dataset_loader, net, device=device)

            # print("calculating map.......")
            mAP = CalcTopMap(trn_binary.numpy(), tst_binary.numpy(), trn_label.numpy(), tst_label.numpy(),
                             config["topK"])
BigBoomDream commented 2 years ago

hi, thank you very much for your work, the database.txt test.txt and train.txt of cifar10 in data is not given

swuxyj commented 2 years ago

hi, thank you very much for your work, the database.txt test.txt and train.txt of cifar10 in data is not given

You can get the cifar10 dataset by import torchvision.datasets, and then directly divide it in multiple ways. You can refer to the code, of course, You can also generate these files yourself.