Skip to content

Commit

Permalink
update contextdesc to newest version
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuhe Jin committed Jun 2, 2020
1 parent ebf2f1c commit ed6701c
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 7 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,12 @@ Use environment `hardnet` and download the model weights:
mkdir third_party/contextdesc/pretrained
wget https://research.altizure.com/data/contextdesc_models/contextdesc_pp.tar -O third_party/contextdesc/pretrained/contextdesc_pp.tar
wget https://research.altizure.com/data/contextdesc_models/retrieval_model.tar -O third_party/contextdesc/pretrained/retrieval_model.tar
wget https://research.altizure.com/data/contextdesc_models/contextdesc_pp_upright.tar -O third_party/contextdesc/pretrained/contextdesc_pp_upright.tar
tar -C third_party/contextdesc/pretrained/ -xf third_party/contextdesc/pretrained/contextdesc_pp.tar
tar -C third_party/contextdesc/pretrained/ -xf third_party/contextdesc/pretrained/contextdesc_pp_upright.tar
tar -C third_party/contextdesc/pretrained/ -xf third_party/contextdesc/pretrained/retrieval_model.tar
rm third_party/contextdesc/pretrained/contextdesc_pp.tar
rm third_party/contextdesc/pretrained/contextdesc_pp_upright.tar
rm third_party/contextdesc/pretrained/retrieval_model.tar
```
Generate the `.yaml` file for ContextDesc:
Expand Down
30 changes: 24 additions & 6 deletions generate_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
if not os.path.isdir('yaml'):
os.makedirs('yaml')

model_dict = {}
model_dict['contextdesc++'] = 'contextdesc++/model.ckpt-400000'
model_dict['reg_model'] = 'retrieval_model/model.ckpt-550000'
model_dict['contextdesc++_upright'] ='contextdesc++_upright/model.ckpt-390000'

parser = argparse.ArgumentParser(description='Geenerate yaml for contextdesc script')

parser.add_argument(
Expand All @@ -26,18 +31,29 @@
help = 'number of keypoints to extract'
)

parser.add_argument(
'--upright',
action='store_true',
default=False,
help = 'number of keypoints to extract'
)

args, unparsed = parser.parse_known_args()

dict_file = {}
dict_file['data_name']='imw2019'
dict_file['data_split'] =''
dict_file['data_root'] = args.data_root

dict_file['all_jpeg'] = True
dict_file['truncate'] = [0, None]

dict_file['pretrained'] = {}
dict_file['pretrained']['loc_model'] = 'third_party/contextdesc/pretrained/contextdesc++'
dict_file['pretrained']['reg_model'] = 'third_party/contextdesc/pretrained/retrieval_model'
dict_file['pretrained']['reg_model'] = 'third_party/contextdesc/pretrained/' + model_dict['reg_model']

if args.upright:
dict_file['pretrained']['loc_model'] = 'third_party/contextdesc/pretrained/' + model_dict['contextdesc++_upright']
else:
dict_file['pretrained']['loc_model'] = 'third_party/contextdesc/pretrained/' + model_dict['contextdesc++']

dict_file['reg_feat'] ={}
dict_file['reg_feat']['infer'] = True
Expand All @@ -50,15 +66,17 @@
dict_file['loc_feat']['n_feature']= args.num_keypoints
dict_file['loc_feat']['batch_size']= 512
dict_file['loc_feat']['dense_desc']= False
dict_file['loc_feat']['peak_thld']= 0
dict_file['loc_feat']['peak_thld']= -10000
dict_file['loc_feat']['edge_thld']= -10000
dict_file['loc_feat']['max_dim']= 1280
dict_file['loc_feat']['upright']= False
dict_file['loc_feat']['upright']= args.upright
dict_file['loc_feat']['scale_diff']= True

dict_file['aug_feat'] = {}
dict_file['aug_feat']['infer']= True
dict_file['aug_feat']['overwrite']= False
dict_file['aug_feat']['quantz']= True
dict_file['aug_feat']['reg_feat_dim']= 2048
dict_file['aug_feat']['quantz']= False

dict_file['post_format'] = {}
dict_file['post_format']['enable'] = True
Expand Down

0 comments on commit ed6701c

Please sign in to comment.