ushasi / A-Simplified-framework-for-Zero-shot-Cross-Modal-Sketch-Data-Retrieval

We deal with the problem of zero-shot cross-modal image retrieval involving color and sketch images through a novel deep representation learning technique.
14 stars 1 forks source link

How to train and test #1

Closed haowang1992 closed 3 years ago

haowang1992 commented 4 years ago

Hi, thanks for your work! I am a little confused to train and test. Could you give some scripts to train and test on all datasets?

ushasi commented 4 years ago

Hi Hao, The code Unified_XY_triads.py loads the entire dataset and splits the data into the train and tests automatically. You just need to provide the consolidated feature files for the images in UxUyLoader.py file.

The rest will be managed in the triads files.

Thanks,

On Sun, Jun 21, 2020 at 9:13 AM Hao Wang (王浩) notifications@github.com wrote:

Hi, thanks for your work! I am a little confused to train and test. Could you give some scripts to train and test on all datasets?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ushasi/A-Simplified-framework-for-Zero-shot-Cross-Modal-Sketch-Data-Retrieval/issues/1, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABDXXZZET7M5RBN2OVVMXNDRXWXLBANCNFSM4ODXMGVA .

--

Ushasi Chaudhuri, Ph.D. Research Scholar, Indian Institute of Technology, Bombay.

haowang1992 commented 4 years ago

Thanks for your reply. But I still confused about your training and evaluation code, especially how to calculate mAP and precision. I will be very grateful if you can complete this repository.

ushasi commented 4 years ago

Look at the last part of the code (i.e., line 499 onwards). Here, we load the trained model and pass each sketch and image through the network and get the unified feature embeddings. These embeddings are saved in the 'unified_features.mat' matrix, as a MatLab readable file. When you view this .mat file in MatLab, you'll find 'featurex' and 'featurey' for the image and sketch modality, respectively. These are the trained feature embeddings from the network.

For testing, take any instance embedding and just run a k-NN code (Euclidean distance) and find the nearest retrieved data samples from the other modality. This is the basic idea for the testing part. I shall also be uploading the MatLab code for this k-NN retrieval and mAP calculation in a few days (maybe a week) and complete the repository. Thanks,

haowang1992 commented 4 years ago

Thanks for your response. As far as know, the data split and evaluation code matter a lot in reported performance number.

ushasi commented 4 years ago

Hi Hao, I have uploaded the MatLab file for performing the zero-shot retrieval and the corresponding evaluation matrices. The data-split is randomly done for the test and train during the runtime.