luhaofang / tripletloss

tripletloss in caffe

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Training your code on custom dataset

abhisheksgumadi opened this issue · comments

hi,

I kind of understand the steps required to train and my question is specifically with respect to preparing the dataset for training. I see img folder and the data folder.

Inside img folder let us say we have images named like 1.jpg, 2.jpg, 3.jpg and so on. How should my trainval.txt file look like in data folder? is it enough for it have on every line the name of the file for every image followed by space and the label like:

1.jpg 1
2.jpg 1
3.jpg 5

and so on where 1.jpg belongs to class 1, 2.jpg belongs to class 2 and 3.jpg belongs to class 5 and so on?

Please let me know what you think.

Thanks
Abhishek S

@abhisheksgumadi I use mark-1501 as the data-set . And I just read all the train image into a python dictionary or a C++ map. The key is the group number and the value is a list of image names. Every iteration you can just select a group number and find the two images in this group as anchor and positive sample. And find another group number and find one image in this group as negative sample. And the loss function just get the distance between these three samples.