ipl-uw / 2019-CVPR-AIC-Track-2-UWIPL

Repository for 2019 CVPR AI City Challenge Track 2 from IPL@UW
MIT License
21 stars 12 forks source link

Train the model for track 1 #3

Open P3ngLiu opened 5 years ago

P3ngLiu commented 5 years ago

Hi

I'm trying to practice and redo your work on AIcity track1. I saw this is a detailed guidance about how to train a ReID model using the AIcity track2 dataset. But i'm not clear about how to train the model for track1. I already have the AIcity track 1 dataset. Can you provide some more detailed guidance about training the model for track 1?

Thank you so much!

jrcai commented 5 years ago

Hi P3ngLiu,

Please refer to https://github.com/ipl-uw/2019-CVPR-AIC-Track-1-UWIPL Deep Feature Re_identification part. Starting from the second row, there are guidelines on how to convert track1 videos into cropped images for reid and obtain feature files. Please let us know if you have any questions. Hope this helps!

P3ngLiu commented 4 years ago

Hi P3ngLiu,

Please refer to https://github.com/ipl-uw/2019-CVPR-AIC-Track-1-UWIPL Deep Feature Re_identification part. Starting from the second row, there are guidelines on how to convert track1 videos into cropped images for reid and obtain feature files. Please let us know if you have any questions. Hope this helps!

Hi jrcai

Yes, i sucessfully got the results of track1 using your pretrained model and guidelines. But my problem is that how to train a ReID model using track 1 dataset. The Guidelines of your code only has the steps of training ReID model using track 2 dataset. But the structure of track1 and track 2 dataset are different, so how you got the ReID model for track1?

P3ngLiu commented 4 years ago

@jrcai One more question is that i got an error when trying to run the main_video_person_reid.py for training the track 2 ReID model. Can you help me find out how to solve it? I have already followed your guidelines to prerpocess the track2 dataset.

(ReID) D:\Github\2019-CVPR-AIC-Track-2-UWIPL\Video-Person-ReID>python main_video_person_reid.py --train-batch 16 --workers 0 --seq-len 4 --arch resnet50ta_surface_nu --width 224 --height 224 --dataset aictrack2 --use-surface --save-dir log --learning-rate 0.0001 --eval-step 50 --save-step 50 --gpu-devices 0 --re-ranking --metadata-model v2m100 --bstri

Args:Namespace(arch='resnet50ta_surface_nu', aug_rot=False, augf_surface=False, bstri=True, cluster_gallery=False, dataset='aictrack2', eval_step=50, evaluate=False, evaluate_multiple=False, feature_dir='./feature', feature_only=False, gamma=0.1, gpu_devices='0', height=224, htri_only=False, load_feature=False, lr=0.0001, margin=0.3, max_epoch=800, metadata_model='v2m100', metas='0,1,2', num_instances=4, pool='avg', pretrained_model='/home/jiyang/Workspace/Works/video-person-reid/3dconv-person-reid/pretrained_models/resnet-50-kinetics.pth', pretrained_model_folder='log/', print_freq=40, re_ranking=True, sample_replace=False, save_dir='log', save_step=50, seed=1, seq_len=4, start_epoch=0, stepsize=200, test_batch=1, train_batch=16, use_cpu=False, use_small_dataset=False, use_surface=True, visualize_ranks=False, weight_decay=0.0005, width=224, workers=0)

Currently using GPU 0 Initializing dataset aictrack2 Note: if root path is changed, the previously generated json files need to be re-generated (so delete them first) => Automatically generating split (might take a while for the first time, have a coffe) Processing 'D:/UAlbany/AICity_2019/aic19-track2-reid/aic19-track2-reid/image_train_deepreid' with 333 person identities Saving split to D:\UAlbany__AICity_2019\aic19-track2-reid\aic19-track2-reid\split_train.json => Automatically generating split (might take a while for the first time, have a coffe) Processing 'D:/UAlbany/__AICity_2019/aic19-track2-reid/aic19-track2-reid/image_train_deepreid' with 333 person identities Saving split to D:\UAlbany__AICity_2019\aic19-track2-reid\aic19-track2-reid\split_train_orig.json => Automatically generating split (might take a while for the first time, have a coffe) Processing 'D:/UAlbany/AICity_2019/aic19-track2-reid/aic19-track2-reid/image_query_deepreid' with 1052 person identities Saving split to D:\UAlbany__AICity_2019\aic19-track2-reid\aic19-track2-reid\split_query.json => Automatically generating split (might take a while for the first time, have a coffe) Processing 'D:/UAlbany/__AICity_2019/aic19-track2-reid/aic19-track2-reid/image_test_deepreid' with 798 person identities Saving split to D:\UAlbany__AICity_2019\aic19-track2-reid\aic19-track2-reid\split_gallery.json => aic19-track2-reid loaded Dataset statistics: subset | # ids | # tracklets | # cameras train | 333 | 1897 | 36 query | 1052 | 1052 | 1 gallery | 798 | 798 | 1 number of images per tracklet: 1 ~ 58, average 15.02 Initializing model: resnet50ta_surface_nu Model size: 49.92045M ==> Epoch 1/800 Traceback (most recent call last): File "main_video_person_reid.py", line 1003, in main() File "main_video_person_reid.py", line 346, in main train(model, criterion_xent, criterion_htri, criterion_bstri, optimizer, trainloader, use_gpu, epoch) File "main_video_person_reid.py", line 381, in train for batchidx, (imgs, surfaces, pids, , _metadatas) in enumerate(trainloader): File "C:\Users\benny\Anaconda3\envs\ReID\lib\site-packages\torch\utils\data\dataloader.py", line 346, in next data = self._dataset_fetcher.fetch(index) # may raise StopIteration File "C:\Users\benny\Anaconda3\envs\ReID\lib\site-packages\torch\utils\data_utils\fetch.py", line 47, in fetch return self.collate_fn(data) File "C:\Users\benny\Anaconda3\envs\ReID\lib\site-packages\torch\utils\data_utils\collate.py", line 79, in default_collate return [default_collate(samples) for samples in transposed] File "C:\Users\benny\Anaconda3\envs\ReID\lib\site-packages\torch\utils\data_utils\collate.py", line 79, in return [default_collate(samples) for samples in transposed] File "C:\Users\benny\Anaconda3\envs\ReID\lib\site-packages\torch\utils\data_utils\collate.py", line 55, in default_collate return torch.stack(batch, 0, out=out) RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 0. Got 4 and 2 in dimension 1 at C:\w\1\s\tmp_conda_3.7_183424\conda\conda-bld\pytorch_1570818936694\work\aten\src\TH/generic/THTensor.cpp:689