Skip to content

Train about custom data #6

@hewumars

Description

@hewumars

I use SOLAR for vehicle re-identification/pedestrian re-identification. but generate custom dataset is wrong.
After the network converges, the negative sample l2 distance is close to 0 in create_epoch_tuples.
In the evaluation, rank1 is close to 100%, but mAP is very low.

# create db pickle
_,_,image_paths,file_ids,labels = gil('custom_train.csv','/home/lxk/ZHP/data/VeIDData/VERI',True)

for mode in ['train', 'val']:
    image_list = train_idx_list if mode == 'train' else val_idx_list
  
    # boxes_dict = boxes[mode]

    for i,list in tqdm(image_list.items()):
        for idx in list:
            positives = []

            db_dict[mode]['cids'].append(image_paths[idx]) # image path

            db_dict[mode]['cluster'].append(labels[idx])   # class label

            pidxs_potential = [i for i in list]

            try:
                pidxs_potential.remove(idx)
            except:
                pass

            if len(pidxs_potential) == 0:
                continue

            pidxs = np.random.choice(pidxs_potential, min(len(pidxs_potential), 1)).tolist()

            db_dict[mode]['bbxs'].append(None) # bbox none

            db_dict[mode]['qidxs'].append(idx)    #anchor image idx
            db_dict[mode]['pidxs'].append(pidxs[0])  #postive image idx


save_path = './db_gl18.pkl'

pickle.dump(db_dict, open(save_path, 'wb'))
# in class TuplesBatchedDataset(data.Dataset): def __init__
self.images = [os.path.join(self.ims_root, db['cids'][i]+'.jpg') for i in range(len(db['cids']))]
#modified to 
self.images = [db['cids'][i] for i in range(len(db['cids']))]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions