Skip to content

Commit

Permalink
switch to testB
Browse files Browse the repository at this point in the history
  • Loading branch information
TomHeaven committed Dec 31, 2019
1 parent 896ded0 commit 34b83d9
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 209 deletions.
8 changes: 0 additions & 8 deletions continue_ft.sh

This file was deleted.

2 changes: 1 addition & 1 deletion data/datasets/competition1910.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class Competition1910(ImageDataset):
# images: 12936 (train) + 3368 (query) + 15913 (gallery)
"""
dataset_dir = '复赛'
test_data_dir = '复赛/测试集A'
test_data_dir = '复赛/测试集B'

def __init__(self, root, test_phase=False, fine_tune=False, **kwargs):
#print('fine_tune', fine_tune)
Expand Down
14 changes: 7 additions & 7 deletions data_preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,15 +138,15 @@ def split_myval(data_dir):
print('gallery', len(gallery), gallery)

if __name__ == '__main__':
data_dir = '/Volumes/Data/比赛/行人重识别2019/data/复赛'
data_dir = '../data/复赛'
list_file = 'train_list.txt'
preprocess_train(data_dir, list_file)
split_myval(data_dir)
#preprocess_train(data_dir, list_file)
#split_myval(data_dir)

data_dir = '/Volumes/Data/比赛/行人重识别2019/data/复赛/测试集A'
#preprocess_query(data_dir, sub_dir='query_a')
data_dir = '../data/复赛/测试集B'
preprocess_query(data_dir, sub_dir='query_b')


data_dir = '/Volumes/Data/比赛/行人重识别2019/data/复赛/测试集A'
#preprocess_gallery(data_dir, sub_dir='gallery_a')
data_dir = '../data/复赛/测试集B'
preprocess_gallery(data_dir, sub_dir='gallery_b')

176 changes: 0 additions & 176 deletions data_preprocess_kfold.py

This file was deleted.

8 changes: 0 additions & 8 deletions ft_test_resnext101.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,6 @@ ln -s -f /home/tomheaven/比赛/行人重识别2019/data/复赛/测试集A/fine
sh scripts/ft_resnext101.sh
sh scripts/test_saving_resnext101.sh

# 4
echo 'Section 4'
rm -r /home/tomheaven/比赛/行人重识别2019/data/复赛/测试集A/fine_tune_0.6
rm /home/tomheaven/比赛/行人重识别2019/data/复赛/测试集A/fine_tune
python3 prepare_fine_tune_data.py --thresh 0.6
ln -s -f /home/tomheaven/比赛/行人重识别2019/data/复赛/测试集A/fine_tune_0.6 /home/tomheaven/比赛/行人重识别2019/data/复赛/测试集A/fine_tune
sh scripts/ft_resnext101.sh
sh scripts/test_saving_resnext101.sh



Expand Down
6 changes: 3 additions & 3 deletions prepare_fine_tune_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ def prepare_fine_tune_data(json_path, dist_path, image_folder, thresh):
os.mkdir(write_dir)

for idx, query_path in enumerate(tqdm.tqdm(results.keys())):
full_query_path = osp.join(image_folder, 'query_a', query_path)
full_query_path = osp.join(image_folder, 'query_b', query_path)
shutil.copy(full_query_path, osp.join(image_folder, f'fine_tune_{thresh:.1f}', str(idx) + '_' + query_path))

for i in range(200):
if dist_mat[idx][indicies[idx, i]] < thresh:
gallery_path = results[query_path][i]
img_path = osp.join(image_folder, 'gallery_a', gallery_path)
img_path = osp.join(image_folder, 'gallery_b', gallery_path)
shutil.copy(img_path, osp.join(image_folder, f'fine_tune_{thresh:.1f}', str(idx) + '_' + gallery_path))
else:
break
Expand All @@ -42,7 +42,7 @@ def prepare_fine_tune_data(json_path, dist_path, image_folder, thresh):
parser.add_argument('--json_path', type=str, help="json_path", default='submit/reid_resnext101_ibn_ft_flip_rerank_cross.json')
parser.add_argument('--dist_path', type=str, help="dist_path", default='dist_mats/test_resnext101_ibn_ft_flip_rerank_cross.h5')
parser.add_argument('--image_folder', type=str, help="image_folder",
default='../data/复赛/测试集A')
default='../data/复赛/测试集B')
parser.add_argument('--thresh', type=float, help="threshold")
args = parser.parse_args()

Expand Down
7 changes: 2 additions & 5 deletions scripts/test_saving_multiple_model.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@

GPUS='0'

CUDA_VISIBLE_DEVICES=$GPUS python3 tools/test_save_res_multi_model.py --test_phase -cfg='configs/softmax_triplet.yml' \
DATASETS.TEST_NAMES 'competition1910' \
TEST.DISTMAT1 '/Volumes/Data/比赛/行人重识别2019/dist_mats/sota/baseline_v5.1_distmat.h5' \
TEST.DISTMAT2 '/Volumes/Data/比赛/行人重识别2019/dist_mats/sota/test_resnet101_ibn_20191218_230227_flip_rerank_both.h5_sorted.h5' \
TEST.DISTMAT3 '/Volumes/Data/比赛/行人重识别2019/dist_mats/sota/test_resnext101_ibn_20191219_003243_flip_rerank_both.h5_sorted.h5' \
TEST.DISTMAT4 '/Volumes/Data/比赛/行人重识别2019/dist_mats/sota/test_mgn_resnet50_ibn_20191222_004057_flip_rerank_cross.h5_sorted.h5' \
TEST.DISTMAT1 'dist_mats/test_resnext101_ibn_ft_flip_rerank_cross.h5' \
TEST.DISTMAT2 'dist_mats/test_resnet101_ibn_ft_flip_rerank_cross.h5' \



Expand Down
2 changes: 1 addition & 1 deletion scripts/test_saving_resnet101.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export CUDA_VISIBLE_DEVICES='0'
export CUDA_VISIBLE_DEVICES='1'

python3 tools/test_save_res.py --test_phase --fine_tune -cfg='configs/softmax_triplet.yml' \
DATASETS.TEST_NAMES 'competition1910' \
Expand Down

0 comments on commit 34b83d9

Please sign in to comment.