From 7348cb3fd182326841f58c157ed545af4b5c03b4 Mon Sep 17 00:00:00 2001 From: hubenyi <867320491@qq.com> Date: Thu, 2 Apr 2020 14:18:35 +0800 Subject: [PATCH] upload --- configs/caltech.yaml | 81 ++++++++++++++++++++++++++++++++++ configs/caltech_w_tricks.yaml | 72 ++++++++++++++++++++++++++++++ configs/cub.yaml | 83 +++++++++++++++++++++++++++++++++++ configs/cub_w_tricks.yaml | 71 ++++++++++++++++++++++++++++++ configs/duke.yaml | 77 ++++++++++++++++++++++++++++++++ configs/duke_w_tricks.yaml | 70 +++++++++++++++++++++++++++++ configs/indoor.yaml | 81 ++++++++++++++++++++++++++++++++++ configs/indoor_w_tricks.yaml | 68 ++++++++++++++++++++++++++++ configs/market.yaml | 77 ++++++++++++++++++++++++++++++++ configs/market_w_tricks.yaml | 68 ++++++++++++++++++++++++++++ configs/oxford.yaml | 83 +++++++++++++++++++++++++++++++++++ configs/oxford_w_tricks.yaml | 69 +++++++++++++++++++++++++++++ configs/paris.yaml | 48 ++++++++++++++++++++ 13 files changed, 948 insertions(+) create mode 100644 configs/caltech.yaml create mode 100644 configs/caltech_w_tricks.yaml create mode 100644 configs/cub.yaml create mode 100644 configs/cub_w_tricks.yaml create mode 100644 configs/duke.yaml create mode 100644 configs/duke_w_tricks.yaml create mode 100644 configs/indoor.yaml create mode 100644 configs/indoor_w_tricks.yaml create mode 100644 configs/market.yaml create mode 100644 configs/market_w_tricks.yaml create mode 100644 configs/oxford.yaml create mode 100644 configs/oxford_w_tricks.yaml create mode 100644 configs/paris.yaml diff --git a/configs/caltech.yaml b/configs/caltech.yaml new file mode 100644 index 0000000..149c47a --- /dev/null +++ b/configs/caltech.yaml @@ -0,0 +1,81 @@ +# retrieval settings + +datasets: + # number of images in a batch. + batch_size: 16 + + # function for stacking images in a batch. + collate_fn: + name: "CollateFn" # name of the collate_fn. + + # function for loading images. + folder: + name: "Folder" # name of the folder. + + # a list of data augmentation functions. + transformers: + names: ["PadResize", "ToTensor", "Normalize"] # names of transformers. + PadResize: + size: 224 # target size of the longer edge. + Normalize: + mean: [0.485, 0.456, 0.406] + std: [0.229, 0.224, 0.225] + +model: + name: "resnet50" # name of the model. + resnet50: + load_checkpoint: "torchvision://resnet50" # path of the model checkpoint. If it is started with "torchvision://", the model will be loaded from torchvision. + +extract: + # way to assemble features if transformers produce multiple images (e.g. TwoFlip, TenCrop). 0 means concat these features and 1 means sum these features. + assemble: 0 + + # function for assigning output features. + extractor: + name: "ResSeries" # name of the extractor. + ResSeries: + extract_features: ["pool5"] # name of the output feature map. If it is ["all"], then all available features will be output. + + # function for splitting the output features (e.g. PCB). + splitter: + name: "Identity" # name of the function for splitting features. + + # a list of pooling functions. + aggregators: + names: ["GeM"] # names of aggregators. + +index: + # path of the query set features and gallery set features. + query_fea_dir: "/data/features/best_features/caltech/query" + gallery_fea_dir: "/data/features/best_features/caltech/gallery" + + # name of the features to be loaded. It should be "output feature map" + "_" + "aggregation". + # If there are multiple elements in the list, they will be concatenated on the channel-wise. + feature_names: ["pool5_GeM"] + + # a list of dimension process functions. + dim_processors: + names: ["L2Normalize", "PCA", "L2Normalize"] # names of dimension processors. + PCA: + proj_dim: 512 # the dimension after reduction. If it is 0, then no reduction will be done. + whiten: False # whether do whiten when using PCA. + train_fea_dir: "/data/features/best_features/caltech/gallery" # path of the features for training PCA. + l2: True # whether do l2-normalization on the training features. + + # function for enhancing the quality of features. + feature_enhancer: + name: "Identity" # name of the feature enhancer. + + # function for calculating the distance between query features and gallery features. + metric: + name: "KNN" # name of the metric. + + # function for re-ranking the results. + re_ranker: + name: "Identity" # name of the re-ranker. + +evaluate: + # function for evaluating results. + evaluator: + name: "OverAll" # name of the evaluator. + diff --git a/configs/caltech_w_tricks.yaml b/configs/caltech_w_tricks.yaml new file mode 100644 index 0000000..e3cedbe --- /dev/null +++ b/configs/caltech_w_tricks.yaml @@ -0,0 +1,72 @@ +# retrieval settings + +datasets: + batch_size: 16 + + collate_fn: + name: "CollateFn" + + folder: + name: "Folder" + + transformers: + names: ["PadResize", "ToTensor", "Normalize"] + PadResize: + size: 224 + Normalize: + mean: [0.485, 0.456, 0.406] + std: [0.229, 0.224, 0.225] + +model: + name: "resnet50" + resnet50: + load_checkpoint: "torchvision://resnet50" + +extract: + assemble: 0 + + extractor: + name: "ResSeries" + ResSeries: + extract_features: ["pool5"] + + splitter: + name: "Identity" + + aggregators: + names: ["GeM"] + +index: + query_fea_dir: "/data/features/best_features/caltech/query" + gallery_fea_dir: "/data/features/best_features/caltech/gallery" + + feature_names: ["pool5_GeM"] + + dim_processors: + names: ["L2Normalize", "PCA", "L2Normalize"] + PCA: + proj_dim: 512 + whiten: False + train_fea_dir: "/data/features/best_features/caltech/gallery" + l2: True + + feature_enhancer: + name: "DBA" + DBA: + enhance_k: 10 # number of the nearest points to be calculated. + + metric: + name: "KNN" + + re_ranker: + name: "QEKR" + QEKR: + qe_times: 1 # number of query expansion times. + qe_k: 10 # number of the neighbors to be combined. + k1: 20 # hyper-parameter for calculating jaccard distance. + k2: 6 # hyper-parameter for calculating local query expansion. + lambda_value: 0.3 # hyper-parameter for calculating the final distance. + +evaluate: + evaluator: + name: "OverAll" diff --git a/configs/cub.yaml b/configs/cub.yaml new file mode 100644 index 0000000..31b6db0 --- /dev/null +++ b/configs/cub.yaml @@ -0,0 +1,83 @@ +# retrieval settings + +datasets: + # number of images in a batch. + batch_size: 16 + + # function for stacking images in a batch. + collate_fn: + name: "CollateFn" # name of the collate_fn. + + # function for loading images. + folder: + name: "Folder" # name of the folder. + + # a list of data augmentation functions. + transformers: + names: ["ShorterResize", "CenterCrop", "ToTensor", "Normalize"] # names of transformers. + ShorterResize: + size: 256 # target size of the shorter edge. + CenterCrop: + size: 224 # target size of the crop img. + Normalize: + mean: [0.485, 0.456, 0.406] + std: [0.229, 0.224, 0.225] + +model: + name: "resnet50" # name of the model. + resnet50: + load_checkpoint: "torchvision://resnet50" # path of the model checkpoint, If it is started with "torchvision://", the model will be loaded from torchvision. + +extract: + # way to assemble features if transformers produce multiple images (e.g. TwoFlip, TenCrop). 0 means concat these features and 1 means sum these features. + assemble: 0 + + # function for assigning output features. + extractor: + name: "ResSeries" # name of the extractor. + ResSeries: + extract_features: ["pool5"] # name of the output feature map. If it is ["all"], then all available features will be output. + + # function for splitting the output features (e.g. PCB). + splitter: + name: "Identity" # name of the function for splitting features. + + # a list of pooling functions. + aggregators: + names: ["SCDA"] # names of aggregators. + +index: + # path of the query set features and gallery set features. + query_fea_dir: "/data/features/best_features/cub/query" + gallery_fea_dir: "/data/features/best_features/cub/gallery" + + # name of the features to be loaded. It should be "output feature map" + "_" + "aggregation". + # If there are multiple elements in the list, they will be concatenated on the channel-wise. + feature_names: ["pool5_SCDA"] + + # a list of dimension process functions. + dim_processors: + names: ["L2Normalize", "PCA", "L2Normalize"] # names of dimension processors. + PCA: + proj_dim: 512 # the dimension after reduction. If it is 0, then no reduction will be done. + whiten: False # whether do whiten when using PCA. + train_fea_dir: "/data/features/best_features/cub/gallery" # path of the features for training PCA. + l2: True # whether do l2-normalization on the training features. + + # function for enhancing the quality of features. + feature_enhancer: + name: "Identity" # name of the feature enhancer. + + # function for calculating the distance between query features and gallery features. + metric: + name: "KNN" # name of the metric. + + # function for re-ranking the results. + re_ranker: + name: "Identity" # name of the re-ranker. + +evaluate: + # function for evaluating results. + evaluator: + name: "OverAll" # name of the evaluator. + diff --git a/configs/cub_w_tricks.yaml b/configs/cub_w_tricks.yaml new file mode 100644 index 0000000..6315cbc --- /dev/null +++ b/configs/cub_w_tricks.yaml @@ -0,0 +1,71 @@ +# retrieval settings + +datasets: + batch_size: 16 + + collate_fn: + name: "CollateFn" + + folder: + name: "Folder" + + transformers: + names: ["ShorterResize", "CenterCrop", "ToTensor", "Normalize"] + ShorterResize: + size: 256 + CenterCrop: + size: 224 + Normalize: + mean: [0.485, 0.456, 0.406] + std: [0.229, 0.224, 0.225] + +model: + name: "resnet50" + resnet50: + load_checkpoint: "torchvision://resnet50" + +extract: + assemble: 0 + + extractor: + name: "ResSeries" + ResSeries: + extract_features: ["pool5"] + + splitter: + name: "Identity" + + aggregators: + names: ["SCDA"] + +index: + query_fea_dir: "/data/features/best_features/cub/query" + gallery_fea_dir: "/data/features/best_features/cub/gallery" + + feature_names: ["pool5_SCDA"] + + dim_processors: + names: ["L2Normalize", "PCA", "L2Normalize"] + PCA: + proj_dim: 512 + whiten: False + train_fea_dir: "/data/features/best_features/cub/gallery" + l2: True + + feature_enhancer: + name: "Identity" + + metric: + name: "KNN" + + re_ranker: + name: "KReciprocal" + KReciprocal: + k1: 20 # hyper-parameter for calculating jaccard distance. + k2: 6 # hyper-parameter for calculating local query expansion. + lambda_value: 0.3 # hyper-parameter for calculating the final distance. + +evaluate: + evaluator: + name: "OverAll" + diff --git a/configs/duke.yaml b/configs/duke.yaml new file mode 100644 index 0000000..08206ba --- /dev/null +++ b/configs/duke.yaml @@ -0,0 +1,77 @@ +# retrieval settings + +datasets: + # number of images in a batch. + batch_size: 16 + + # function for stacking images in a batch. + collate_fn: + name: "CollateFn" + + # function for loading images. + folder: + name: "Folder" + + # a list of data augmentation functions. + transformers: + names: ["DirectResize", "TwoFlip", "ToTensor", "Normalize"] # names of transformers. + DirectResize: + size: (256, 128) # target size of the output img. + interpolation: 3 # nearest interpolation + Normalize: + mean: [0.485, 0.456, 0.406] + std: [0.229, 0.224, 0.225] + +model: + name: "ft_net" # name of the model. + ft_net: + load_checkpoint: "/home/songrenjie/projects/reID_baseline/model/ft_ResNet50/res50_duke.pth" # path of the model checkpoint, If it is started with "torchvision://", the model will be loaded from torchvision. + +extract: + # way to assemble features if transformers produce multiple images (e.g. TwoFlip, TenCrop). 0 means concat these features and 1 means sum these features. + assemble: 1 + + # function for assigning output features. + extractor: + name: "ReIDSeries" # name of the extractor. + ReIDSeries: + extract_features: ["output"] # name of the output feature map. If it is ["all"], then all available features will be output. + + # function for splitting the output features (e.g. PCB). + splitter: + name: "Identity" # name of the function for splitting features. + + # a list of pooling functions. + aggregators: + names: ["GAP"] # names of aggregators. + +index: + # path of the query set features and gallery set features. + query_fea_dir: "/data/features/best_features/duke/query" + gallery_fea_dir: "/data/features/best_features/duke/gallery" + + # name of the features to be loaded. It should be "output feature map" + "_" + "aggregation". + # If there are multiple elements in the list, they will be concatenated on the channel-wise. + feature_names: ['output'] + + # a list of dimension process functions. + dim_processors: + names: ["L2Normalize"] # names of dimension processors. + + # function for enhancing the quality of features. + feature_enhancer: + name: "Identity" # name of the feature enhancer. + + # function for calculating the distance between query features and gallery features. + metric: + name: "KNN" # name of the metric. + + # function for re-ranking the results. + re_ranker: + name: "Identity" # name of the re-ranker. + +evaluate: + # function for evaluating results. + evaluator: + name: "ReIDOverAll" # name of the evaluator. + diff --git a/configs/duke_w_tricks.yaml b/configs/duke_w_tricks.yaml new file mode 100644 index 0000000..4e6f6ca --- /dev/null +++ b/configs/duke_w_tricks.yaml @@ -0,0 +1,70 @@ +# retrieval settings + +datasets: + batch_size: 16 + + collate_fn: + name: "CollateFn" + + folder: + name: "Folder" + + transformers: + names: ["DirectResize", "TwoFlip", "ToTensor", "Normalize"] + DirectResize: + size: (256, 128) + interpolation: 3 + Normalize: + mean: [0.485, 0.456, 0.406] + std: [0.229, 0.224, 0.225] + +model: + name: "ft_net" + ft_net: + load_checkpoint: "/home/songrenjie/projects/reID_baseline/model/ft_ResNet50/res50_duke.pth" + +extract: + assemble: 1 + + extractor: + name: "ReIDSeries" + ReIDSeries: + extract_features: ["output"] + + splitter: + name: "Identity" + + aggregators: + names: ["GAP"] + +index: + query_fea_dir: "/data/features/best_features/duke/query" + gallery_fea_dir: "/data/features/best_features/duke/gallery" + + feature_names: ['output'] + + dim_processors: + names: ["L2Normalize", "PCA", "L2Normalize"] + PCA: + proj_dim: 512 # the dimension after reduction. If it is 0, then no reduction will be done. + whiten: False # whether do whiten when using PCA. + train_fea_dir: "/data/features/best_features/duke/gallery" # path of the features for training PCA. + l2: True # whether do l2-normalization on the training features. + + feature_enhancer: + name: "Identity" + + metric: + name: "KNN" + + re_ranker: + name: "KReciprocal" + KReciprocal: + k1: 20 # hyper-parameter for calculating jaccard distance. + k2: 6 # hyper-parameter for calculating local query expansion. + lambda_value: 0.3 # hyper-parameter for calculating the final distance. + +evaluate: + evaluator: + name: "ReIDOverAll" + diff --git a/configs/indoor.yaml b/configs/indoor.yaml new file mode 100644 index 0000000..9cdb5ee --- /dev/null +++ b/configs/indoor.yaml @@ -0,0 +1,81 @@ +# retrieval settings + +datasets: + # number of images in a batch. + batch_size: 16 + + # function for stacking images in a batch. + collate_fn: + name: "CollateFn" + + # function for loading images. + folder: + name: "Folder" + + # a list of data augmentation functions. + transformers: + names: ["DirectResize", "ToTensor", "Normalize"] # names of transformers. + DirectResize: + size: (224, 224) # target size of the output img. + Normalize: + mean: [0.485, 0.456, 0.406] + std: [0.229, 0.224, 0.225] + +model: + name: "resnet50" # name of the model. + resnet50: + load_checkpoint: "/data/places365_model/res50_places365.pt" # path of the model checkpoint, If it is started with "torchvision://", the model will be loaded from torchvision. + +extract: + # way to assemble features if transformers produce multiple images (e.g. TwoFlip, TenCrop).. 0 means concat these features and 1 means sum these features. + assemble: 0 + + # function for assigning output features. + extractor: + name: "ResSeries" # name of the extractor. + ResSeries: + extract_features: ["pool5"] # name of the output feature map. If it is ["all"], then all available features will be output. + + # function for splitting the output features (e.g. PCB). + splitter: + name: "Identity" # name of the function for splitting features. + + # a list of pooling functions. + aggregators: + names: ["Crow"] # names of aggregators. + +index: + # path of the query set features and gallery set features. + query_fea_dir: "/data/features/best_features/indoor/query" + gallery_fea_dir: "/data/features/best_features/indoor/gallery" + + # name of the features to be loaded. It should be "output feature map" + "_" + "aggregation". + # If there are multiple elements in the list, they will be concatenated on the channel-wise. + feature_names: ["pool5_Crow"] + + # a list of dimension process functions. + dim_processors: + names: ["L2Normalize", "PCA", "L2Normalize"] + PCA: + proj_dim: 512 # the dimension after reduction. If it is 0, then no reduction will be done. + whiten: False # whether do whiten when using PCA. + train_fea_dir: "/data/features/best_features/indoor/gallery" # path of the features for training PCA. + l2: True # whether do l2-normalization on the training features. + + # function for enhancing the quality of features. + feature_enhancer: + name: "Identity" # name of the feature enhancer. + + # function for calculating the distance between query features and gallery features. + metric: + name: "KNN" # name of the metric. + + # function for re-ranking the results. + re_ranker: + name: "Identity" # name of the re-ranker. + +evaluate: + # function for evaluating results. + evaluator: + name: "OverAll" # name of the evaluator. + diff --git a/configs/indoor_w_tricks.yaml b/configs/indoor_w_tricks.yaml new file mode 100644 index 0000000..1a44333 --- /dev/null +++ b/configs/indoor_w_tricks.yaml @@ -0,0 +1,68 @@ +datasets: + batch_size: 16 + + collate_fn: + name: "CollateFn" + + folder: + name: "Folder" + + transformers: + names: ["DirectResize", "ToTensor", "Normalize"] + DirectResize: + size: (224, 224) #(448, 448) #(224, 224) + Normalize: + mean: [0.485, 0.456, 0.406] + std: [0.229, 0.224, 0.225] + +model: + name: "resnet50" + resnet50: + load_checkpoint: "/data/places365_model/res50_places365.pt" + +extract: + assemble: 0 + + extractor: + name: "ResSeries" + ResSeries: + extract_features: ["pool5"] + + splitter: + name: "Identity" + + aggregators: + names: ["Crow"] + +index: + query_fea_dir: "/data/features/best_features/indoor/query" + gallery_fea_dir: "/data/features/best_features/indoor/gallery" + + feature_names: ["pool5_Crow"] + + dim_processors: + names: ["L2Normalize", "PCA", "L2Normalize"] + PCA: + proj_dim: 512 + whiten: False + train_fea_dir: "/data/features/best_features/indoor/gallery" + l2: True + + feature_enhancer: + name: "DBA" + DBA: + enhance_k: 10 # number of the nearest points to be calculated. + + metric: + name: "KNN" + + re_ranker: + name: "QE" + QE: + qe_times: 1 # number of query expansion times. + qe_k: 10 # number of the neighbors to be combined. + +evaluate: + evaluator: + name: "OverAll" + diff --git a/configs/market.yaml b/configs/market.yaml new file mode 100644 index 0000000..fc862c9 --- /dev/null +++ b/configs/market.yaml @@ -0,0 +1,77 @@ +# retrieval settings + +datasets: + # number of images in a batch. + batch_size: 16 + + # function for stacking images in a batch. + collate_fn: + name: "CollateFn" # name of the collate_fn. + + # function for loading images. + folder: + name: "Folder" # name of the folder. + + # a list of data augmentation functions. + transformers: + names: ["DirectResize", "TwoFlip", "ToTensor", "Normalize"] # names of transformers. + DirectResize: + size: (256, 128) # target size of the output img. + interpolation: 3 # nearest interpolation + Normalize: + mean: [0.485, 0.456, 0.406] + std: [0.229, 0.224, 0.225] + +model: + name: "ft_net" # name of the model. + ft_net: + load_checkpoint: "/data/my_model_zoo/res50_market1501.pth" # path of the model checkpoint, If it is started with "torchvision://", the model will be loaded from torchvision. + +extract: + # way to assemble features if transformers produce multiple images (e.g. TwoFlip, TenCrop).. 0 means concat these features and 1 means sum these features. + assemble: 1 + + # function for assigning output features. + extractor: + name: "ReIDSeries" # name of the extractor. + ReIDSeries: + extract_features: ["output"] # name of the output feature map. If it is ["all"], then all available features will be output. + + # function for splitting the output features (e.g. PCB). + splitter: + name: "Identity" # name of the function for splitting features. + + # a list of pooling functions. + aggregators: + names: ["GAP"] + +index: + # path of the query set features and gallery set features. + query_fea_dir: "/data/features/best_features/market/query" + gallery_fea_dir: "/data/features/best_features/market/gallery" + + # name of the features to be loaded. It should be "output feature map" + "_" + "aggregation". + # If there are multiple elements in the list, they will be concatenated on the channel-wise. + feature_names: ['output'] + + # a list of dimension process functions. + dim_processors: + names: ["L2Normalize"] # names of dimension processors. + + # function for enhancing the quality of features. + feature_enhancer: + name: "Identity" # name of the feature enhancer. + + # function for calculating the distance between query features and gallery features. + metric: + name: "KNN" # name of the metric. + + # function for re-ranking the results. + re_ranker: + name: "Identity" # name of the re-ranker. + +evaluate: + # function for evaluating results. + evaluator: + name: "ReIDOverAll" # name of the evaluator. + diff --git a/configs/market_w_tricks.yaml b/configs/market_w_tricks.yaml new file mode 100644 index 0000000..ab1b851 --- /dev/null +++ b/configs/market_w_tricks.yaml @@ -0,0 +1,68 @@ +datasets: + batch_size: 16 + + collate_fn: + name: "CollateFn" + + folder: + name: "Folder" + + transformers: + names: ["DirectResize", "TwoFlip", "ToTensor", "Normalize"] + DirectResize: + size: (256, 128) + interpolation: 3 + Normalize: + mean: [0.485, 0.456, 0.406] + std: [0.229, 0.224, 0.225] + +model: + name: "ft_net" + ft_net: + load_checkpoint: "/data/my_model_zoo/res50_market1501.pth" + +extract: + assemble: 1 + + extractor: + name: "ReIDSeries" + ReIDSeries: + extract_features: ["output"] + + splitter: + name: "Identity" + + aggregators: + names: ["GAP"] + +index: + query_fea_dir: "/data/features/best_features/market/query" + gallery_fea_dir: "/data/features/best_features/market/gallery" + + feature_names: ['output'] + + dim_processors: + names: ["L2Normalize", "PCA", "L2Normalize"] + PCA: + proj_dim: 512 # the dimension after reduction. If it is 0, then no reduction will be done. + whiten: False # whether do whiten when using PCA. + train_fea_dir: "/data/features/best_features/market/gallery" # path of the features for training PCA. + l2: True # whether do l2-normalization on the training features. + + feature_enhancer: + name: "Identity" + + metric: + name: "KNN" + + re_ranker: + name: "KReciprocal" + KReciprocal: + k1: 20 # hyper-parameter for calculating jaccard distance. + k2: 6 # hyper-parameter for calculating local query expansion. + lambda_value: 0.3 # hyper-parameter for calculating the final distance. + +evaluate: + evaluator: + name: "ReIDOverAll" + diff --git a/configs/oxford.yaml b/configs/oxford.yaml new file mode 100644 index 0000000..2973d71 --- /dev/null +++ b/configs/oxford.yaml @@ -0,0 +1,83 @@ +# retrieval settings + +datasets: + # number of images in a batch. + batch_size: 16 + + # function for stacking images in a batch. + collate_fn: + name: "CollateFn" # name of the collate_fn. + + # function for loading images. + folder: + name: "Folder" # name of the folder. + + # a list of data augmentation functions. + transformers: + names: ["ShorterResize", "CenterCrop", "ToCaffeTensor", "Normalize"] # names of transformers. + ShorterResize: + size: 256 # target size of the shorter edge. + CenterCrop: + size: 224 # target size of the crop img. + Normalize: + mean: [104, 116, 124] + std: [1.0, 1.0, 1.0] + +model: + name: "vgg16" # name of the model. + vgg16: + load_checkpoint: "/data/places365_model/vgg16_hybrid1365.pt" # path of the model checkpoint, If it is started with "torchvision://", the model will be loaded from torchvision. + +extract: + # way to assemble features if transformers produce multiple images (e.g. TwoFlip, TenCrop). 0 means concat these features and 1 means sum these features. + assemble: 0 + + # function for assigning output features. + extractor: + name: "VggSeries" # name of the extractor. + VggSeries: + extract_features: ["pool5"] # name of the output feature map. If it is ["all"], then all available features will be output. + + # function for splitting the output features (e.g. PCB). + splitter: + name: "Identity" # name of the function for splitting features. + + # a list of pooling functions. + aggregators: + names: ["GAP"] # names of aggregators. + +index: + # path of the query set features and gallery set features. + query_fea_dir: "/data/features/best_features/oxford/query" + gallery_fea_dir: "/data/features/best_features/oxford/gallery" + + # name of the features to be loaded. It should be "output feature map" + "_" + "aggregation". + # If there are multiple elements in the list, they will be concatenated on the channel-wise. + feature_names: ["pool5_GAP"] + + # a list of dimension process functions. + dim_processors: + names: ["L2Normalize", "SVD", "L2Normalize"] + SVD: + proj_dim: 511 # the dimension after reduction. If it is 0, then no reduction will be done. + whiten: True # whether do whiten when using SVD. + train_fea_dir: "/data/features/best_features/paris" # path of the features for training SVD. + l2: True # whether do l2-normalization on the training features. + + # function for enhancing the quality of features. + feature_enhancer: + name: "Identity" # name of the feature enhancer. + + # function for calculating the distance between query features and gallery features. + metric: + name: "KNN" # name of the metric. + + # function for re-ranking the results. + re_ranker: + name: "Identity" # name of the re-ranker. + +evaluate: + # function for evaluating results. + evaluator: + name: "OxfordOverAll" # name of the evaluator. + diff --git a/configs/oxford_w_tricks.yaml b/configs/oxford_w_tricks.yaml new file mode 100644 index 0000000..c40265c --- /dev/null +++ b/configs/oxford_w_tricks.yaml @@ -0,0 +1,69 @@ +datasets: + batch_size: 16 + + collate_fn: + name: "CollateFn" + + folder: + name: "Folder" + + transformers: + names: ["ShorterResize", "CenterCrop", "ToCaffeTensor", "Normalize"] + ShorterResize: + size: 256 + CenterCrop: + size: 224 + Normalize: + mean: [104, 116, 124] + std: [1.0, 1.0, 1.0] + +model: + name: "vgg16" + vgg16: + load_checkpoint: "/data/places365_model/vgg16_hybrid1365.pt" + +extract: + assemble: 0 + + extractor: + name: "VggSeries" + VggSeries: + extract_features: ["pool5"] + + splitter: + name: "Identity" + + aggregators: + names: ["GAP"] + +index: + query_fea_dir: "/data/features/best_features/oxford/query" + gallery_fea_dir: "/data/features/best_features/oxford/gallery" + + feature_names: ["pool5_GAP"] + + dim_processors: + names: ["L2Normalize", "SVD", "L2Normalize"] + SVD: + proj_dim: 511 + whiten: True + train_fea_dir: "/data/features/best_features/paris" + l2: True + + feature_enhancer: + name: "Identity" + + metric: + name: "KNN" + + re_ranker: + name: "KReciprocal" + KReciprocal: + k1: 20 # hyper-parameter for calculating jaccard distance. + k2: 6 # hyper-parameter for calculating local query expansion. + lambda_value: 0.3 # hyper-parameter for calculating the final distance. + +evaluate: + evaluator: + name: "OxfordOverAll" + diff --git a/configs/paris.yaml b/configs/paris.yaml new file mode 100644 index 0000000..1aa9f3a --- /dev/null +++ b/configs/paris.yaml @@ -0,0 +1,48 @@ +# retrieval settings + +datasets: + # number of images in a batch. + batch_size: 16 + + # function for stacking images in a batch. + collate_fn: + name: "CollateFn" # name of the collate_fn. + + # function for loading images. + folder: + name: "Folder" # name of the folder. + + # a list of data augmentation functions. + transformers: + names: ["ShorterResize", "CenterCrop", "ToCaffeTensor", "Normalize"] # names of transformers. + ShorterResize: + size: 256 # target size of the shorter edge. + CenterCrop: + size: 224 # target size of the crop img. + Normalize: + mean: [104, 116, 124] + std: [1.0, 1.0, 1.0] + +model: + name: "vgg16" # name of the model. + vgg16: + load_checkpoint: "/data/places365_model/vgg16_hybrid1365.pt" # path of the model checkpoint, If it is started with "torchvision://", the model will be loaded from torchvision. + +extract: + # way to assemble features if transformers produce multiple images (e.g. TwoFlip, TenCrop). 0 means concat these features and 1 means sum these features. + assemble: 0 + + # function for assigning output features. + extractor: + name: "VggSeries" # name of the extractor. + VggSeries: + extract_features: ["pool5"] # name of the output feature map. If it is ["all"], then all available features will be output. + + # function for splitting the output features (e.g. PCB). + splitter: + name: "Identity" # name of the function for splitting features. + + # a list of pooling functions. + aggregators: + names: ["GAP"] # names of aggregators. +