nashory / delf-pytorch Goto Github PK
View Code? Open in Web Editor NEWPyTorch Implementation of "Large-Scale Image Retrieval with Attentive Deep Local Features"
License: MIT License
PyTorch Implementation of "Large-Scale Image Retrieval with Attentive Deep Local Features"
License: MIT License
In the step2: Feature Extraction of DeLF
After the step1, I have get the fix.pth.tar
model file, the config in extractor.py
show here:
MODE = 'pca' # either "delf" or "pca"
GPU_ID = 4
IOU_THRES = 0.98
ATTN_THRES = 0.37
TOP_K = 1000
USE_PCA = False
PCA_DIMS = 40
SCALE_LIST = [0.25, 0.3535, 0.5, 0.7071, 1.0, 1.4142, 2.0]
ARCH = 'resnet50'
EXPR = 'dummy'
TARGET_LAYER = 'layer3'
MODEL_NAME = 'res18_mix_debase_2'
LOAD_FROM = '../train/repo/res18_mix_debase_1/keypoint/ckpt/fix.pth.tar'
PCA_PARAMETERS_PATH = './output/pca/{}/pca.h5'.format(MODEL_NAME)
however, I get the result in console:
Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)
And regardless what I type print()
method to test. there is not anything return.
@nashory hi, I noticed that, when training the keypoint stage, you set use_l2_normalized_feature = True, what's the reason of setting this parameters? And what's more, I noticed that you set target_layer = layer3 by default, have you tried target_layer = layer4? If yes, which one is better?
Another question that confused me is, when I train finetune stage directly on google-landmark-dataset-top1k, I got acc1 over 97.5, how about your result on this stage?
Thank you and wait for your answer.
many image download links are invalid.
I want to extract delf for a dataset of common things like book, bottle, picture. But i found the matching performance of the offered model finetuned on the Romelandmark dataset is bad. So i want to known how to get the model pretrained on imagenet? Or do you have any suggestions for extracting delf for a dataset of common things? Looking forward to your early reply. Thank you very much!
See here the definition of the model in Tensorflow by authors :
https://github.com/tensorflow/models/blob/master/research/delf/delf/python/training/model/delf_model.py
They use BatchNorm between conv1 and conv2 of the spatial attention module.
Thanks for the great pytorch code. It seems that this repo does not support multi-gpu training.
Thanks for the implementation!
In the readme, examples are provided of arguments being passed into the (1) train PCA and (2) extract dimension reduced DeLF steps. However, all the values are hardcoded in extract.py
. Thus, the steps in the main README are somewhat misleading.
Is there specific resoning for hardcoding the extract parameters, but passing the train parameters?
I feel that it would be quite convenient to pass all extract parameters from cli.
Hello! I am always looking at your beneficial repository.
I'm wondering what difference between the dataset used in the pretrain process and finetuning process.
One uses full and one uses clean, what is the difference between this two datasets?
Hi @nashory and everyone,
I have the following error when running get_result(myfeeder, query) in the visualize.ipynb notebook. Could you show me how to fix this? I've tried to reduce workers = 1 to no avail. Thank you in advance!
RuntimeError: CUDA out of memory. Tried to allocate 374.00 MiB (GPU 0; 10.73 GiB total capacity; 9.57 GiB already allocated; 330.62 MiB free; 66.62 MiB cached)
Lack of the function "bar",i will appreciated if you can upload it. Have a nice day!
I wanna extract delf with another network.How to set receptive field, stride and padding of FeatureExtractor class in extractor.py?
There is no file 'archive/model/ldmk/keypoint/ckpt/fix.pth.tar' in the repo, is it missing? How can I get it?
Hi ! Thank you for your great work.
I have a little question. The value of receptive field in layer4 is 483 in your code. But I find you use resnet50 from torchvision model zoo, it is different with resnet50 from tensorflow slim. The value of receptive field in layer4 may be 427 ?
Hi, Thanks for releasing this code
I try to train the model on my dataset
but sometimes when I run the visualize notebook I get an error:
/home/ubuntu/DeLF-pytorch/helper/delf_helper.pyc in GetDelfFeatureFromSingleScale(x, model, scale, pca_mean, pca_vars, pca_matrix, pca_dims, rf, stride, padding, attn_thres, use_pca)
283 # use attention score to select feature.
284 indices = None
--> 285 while(indices is None or len(indices) == 0):
286 indices = torch.gt(scaled_scores, attn_thres).nonzero().squeeze()
287 attn_thres = attn_thres * 0.5 # use lower threshold if no indexes are found.
/usr/local/lib/python2.7/dist-packages/torch/tensor.pyc in __len__(self)
368 def __len__(self):
369 if self.dim() == 0:
--> 370 raise TypeError("len() of a 0-d tensor")
371 return self.shape[0]
any idea why ?
I test the infer time of pytorch, 7scales used 1---2s,
while the infer time of tensorflow ,7 scales just used 0.1--0.2s
how can i speed it?
I try to match two pictures(with your provided trained model), but I meet something wrong like
"UserWarning: An output with one or more elements was resized since it had shape [999], which does not match the required output shape [998].This behavior is deprecated, and in a future PyTorch release outputs will not be resized unless they have zero elements. You can explicitly reuse an out tensor t by resizing it, inplace, to zero elements with t.resize_(0). (Triggered internally at ../aten/src/ATen/native/Resize.cpp:24.)
torch.index_select(x1, 0, idx, out=xx1)"
and it cycle and cycle until
"UserWarning: An output with one or more elements was resized since it had shape [2], which does not match the required output shape [1].This behavior is deprecated, and in a future PyTorch release outputs will not be resized unless they have zero elements. You can explicitly reuse an out tensor t by resizing it, inplace, to zero elements with t.resize_(0). (Triggered internally at ../aten/src/ATen/native/Resize.cpp:24.)
torch.index_select(x1, 0, idx, out=xx1)"
@nashory I am confused and would like your reply please
Hello, what is the training data set? Where can I download it?
For example, the default '../../data/landmarks/landmarks_full_val'
in the code.
error
Did you not upload completely? Missing module'progress' ,I would be very grateful if you could respond.
when running the code, in visualize.ipynb, "from feeder import Feeder", I did't search it, I'd want to know what the feeder packet is and where can I load it? Thank you for your sharing
Hi! I appreciate you(@nashory) releasing the code.
I am very curious about the way you evaluated the benchmark set.
Could you explain to me in detail?
And, if you have that evaluation code, can you release the code?
Functions declared in var __all__
in utils/misc.py
, which are get_mean_and_std
and init_param
, are not implemented. To start training, those two need to be removed from __all__
.
Hi, how run inference for retrieval test image?
I wanna train delf model for product searching, however what kind of datasets should i provide for keypoint training? Is there any off-th-shelf datasets can i use for training?
I will be very grateful if someone can tell me the answer or upload this module.
In train PCA, the error "floor_vml_cpu not implemented for 'Long'" ocur.
I share the pretrained weight trained on landmarkd dataset.
Please download it from the following url:
https://drive.google.com/open?id=1dbdaDyVeIb53iGh4Uk5kA4in9-uURoLM
@nashory Thanks for sharing such a great work. I had downloaded your shared pre-trained weights on landmarks dataset but it seems there's error with the file that I cant read or extract as well.
Can you fix the link or file ?
How to calculate and sort the similarity after extracting the features of the retrieved image and the base image.
Hi,
Thank you for the cool re-implementation! May I ask you about the license on your code?
I would like to port to to the kornia local features https://kornia.readthedocs.io/en/latest/feature.html
--
Best, Dmytro
Hi, I'm trying to train DeLF on my custom dataset but I'm not able to understand how to arrange the data set. Where should i place my data and in what format should it be. Could anyone please help me.
Any help would be great.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.