Coder Social home page Coder Social logo

tf-lift's Introduction

TF-LIFT: Tensorflow Implmentation for Learned Invariant Feature Transform

Basic Usage

Setting the environment

Python Version : 3 OpenCV Version : 3

You'll need to install the dependencies, something like the following:

pip install numpy h5py tensorflow tensorflow-gpu

We will later provide a requirements.txt for you to use with pip.

Also, you need to setup your work directories. Edit the config.py for a convenient default argument setting. See help for more information on what the configurations do.

Training

main.py is the entry point for all your needs. Simply define the task you want to do, the where to save the results (logs) and the training subtask you want to perform.

For example, to train the descriptor

python main.py --task=train --subtask=desc

Note: this will save the logs at logs/main.py---task=train---subtask=desc. If you don't want this behavior, you can also add --logdir=logs/test in the command line argument, for example.

Testing

Testing is even more simple, just provide the input image location, the output file name, keypoint file name (for ori and desc). For example, the following command will run the entire pipeline for image1.jpg, using the model at logs/test.

python main.py --task=test --subtask=kp --logdir=logs/test --test_img_file=image1.jpg \
  --test_out_file=image1_kp.txt
python main.py --task=test --subtask=ori --logdir=logs/test --test_img_file=image1.jpg \
  --test_out_file=image1_ori.txt --test_kp_file=image1_kp.txt
python main.py --task=test --subtask=desc --logdir=logs/test --test_img_file=image1.jpg \
  --test_out_file=image1_desc.h5 --test_kp_file=image1_ori.txt

Note: when trying to load the model, it will always look for the joint trained model first, and fall back to the subtask it is trying to test for.

More notes on training

Saving the network

When training, the network is automatically saved in the logdir. If you don't set this manually, it defaults to logs/{concatenation-of-all-arguments}. The things that are saved are:

  • Tensorflow checkpoint
  • Tensorflow graph metadata
  • mean and std used for input data normalization
  • best validation loss
  • best validation iteration

All these are loaded back when we want to continue.

Loading the network

On all runs, the framework automatically resumes from where it left. In other words, it will always try to load network weights and resume. If the framework cannot find the expected weights, it will just tell you that it could not find weights in the expected locations, and will try to go on its merry way. Note that this is something that you want to keep in mind. For example, if you run the subtask ori, with a typo in logdir pointing you to a directory without the pretrained descriptor weights, the framework will simply try to learn the orientation estimator with random descriptors. This is intended, as this might be something that you actually want to try.

Network loading is performed in the following order, overwriting the previously loaded weights:

  1. Loads the pretrained weights, in the old framework format, from directories defined in pretrained_{subtask} in the configuration. This feature is deprecated and should not be used

  2. Loads the pretrained weights, in the new framework format, from directories defined in pretrained_{subtask} in the configuration.

  3. Loads the weights from the logdir, which is either automatically determined by the command line arguments, or can be given manually.

Differences from the original version

Batch normalization

In the original version, we did not apply batch normalization. In the new version, bach normalization is applied to all layers. This significantly speeds-up the learning process, and makes learning stable. This also eliminates the need for us to normalize the dataset when training, and we can instead simply put the data range in a reasonable range, say -1 to 1 and be done with it. Note that since we do this, we also perform batch normalization on the input.

L2-pooling and Spatial subtractive normalization

We found that these layers can be replaced with normal relus and spatial pooling without significant difference. They are removed.

Pretrained models

We provide new models trained on the `Piccadilly' set from the ECCV paper. Note that they have been trained from scratch with the new framework (as opposed to the theano-based framework we used at the time of the ECCV submission), so there are some changes in the architecture and training procedure. Performance should be about on par.

The files can be downloaded here:

The models trained without rotation augmentation perform better on matching problems where the images are generally upright. For data with random rotations, use the models trained with rotation augmentation.

Data generation example

Several people have had issues generating the training data. We have uploaded an example of what these should look like into example, inclusing the scale histogram files, which you're free to re-use.

tf-lift's People

Contributors

etrulls avatar kmyi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tf-lift's Issues

Professor,thank you for sharing your codes!Here are my questions:

I download the model you provide in the end.(Models without rotation augmentation)and put them in the
folderlog/test .Then ,I run the following commad:
python main.py --task=test --subtask=kp --logdir=logs/test --test_img_file=1.jpg --test_out_file=image1_kp.txt
The error like this:At least two variables have the same name: network/lift/kp/conv-ghh-1/biases

I want to know whether the model match the code!and what is meaning of

run with --use_batch_norm=False --mean_std_type=dataset

Looking for your answer!

Descriptor position

Dear all,

I have run the whole test pipeline on one image (kp, ori, desc). To my surprise, it seems that the number of descriptor doesn't match that of the keypoints.
Therefore my question is : which descriptor vector goes with which keypoint location ?

For example, I extract the keypoints info using the following :

kp_list = loadKpListFromTxt(keypointFile)

And I extract the descriptors from the h5 file as follow :

f = h5py.File(descriptorFile, 'r')
a_group_key = list(f.keys())[0]
descriptors = list(f[a_group_key])

To which element in kp_list does descriptors[i] correspond to ?

no pre-trained models and high training difficulty

Hello. I enjoyed reading the paper. However, I find it very difficult to prepare data for training. If the following issues are resolved, it will be much less difficult for other academic users to adopt it.

  1. Should there be some scripts to automate the training data preparation (i.e. users only need to provide images)?

  2. Or, are there some pre-trained models for other users to compare with? I have not seen them here.

  3. I have tried the theano implementation. I noticed that there is a pre-trained model there. However, the code is really slow. A 300x300 image takes about 8 minutes to get processed on a Titan X GPU. I noticed that some comments in code stating that some steps are for "proof of concept only". However, it would be still good to have a more efficient implementation from the official. I'm not sure about the speed of this tf implementation. Is it actually faster?

Thanks very much for your contribution.

about training datasets

Hello, I am sorry to bother you. I encountered some problems during the training process. Where can I download the training set of the network? When I am training, the following problems always occur:
image
so,can you give me some suggestion?
thank you very much!

how to change the dir into my own?

Dear sir,
I am a college student,As a beginner,I am debugging the main.py file, and I have encountered this problem:SError: Unable to open file (unable to open file: name = '/cvlabdata2/home/JH/Datasets/ECCV/piccadilly/scales-histogram-minsc-2.0.h5'.So I want to convert this path to my own, I wonder if it is feasible? In addition, I hope you can use the training methods described in readme in more detail,.If you have more detailed steps, please send them to my email:[email protected]. thank you!
With best wishes!

Troubles while testing/training

Hello! i've met some problems during testing or training descs.

Trying to train and meeting following pproblem:
https://pp.userapi.com/c824600/v824600054/12566e/u62K0nXm3s0.jpg

Trying to test using pre-trained models from readme's link:
https://pp.userapi.com/c824600/v824600054/125682/ZlHsuOpSbtM.jpg
(yes, there are no such file nor in modules, nor in pre-trained model)

So, am i doing something wrong or it's just some sort of compatibility issue? Using Win 10 x64.
Thanks in advance!

How to test the pretrained model directly?

I downloaded the "release-no-aug" folder and there were three subfolders: "desc", "kp" and "ori".
I created a new folder under tf-lift folder, named "logs".
Under "logs" folder I created a subfolder named "test".
I copyed the three folders "desc", "kp" and "ori" in to the "tf-lift/logs/test/".

I put the test image named "image1.jpg" in "tf-lift/"
and run the command in tf-lift:
python main.py --task=test --subtask=kp --logdir=logs/test --test_img_file=image1.jpg --test_out_file=image1_kp.txt

It gives me an error:
/home/czdong/anaconda3/lib/python3.6/site-packages/h5py/init.py:36: FutureWarning: Conversion of the second argument of issubdtype from float to np.floating is deprecated. In future, it will be treated as np.float64 == np.dtype(float).type.
from ._conv import register_converters as _register_converters
User and hostname: czdong@czdong
2018-11-05 13:50:07.407175: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
2018-11-05 13:50:07.529312: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:897] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2018-11-05 13:50:07.529890: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1405] Found device 0 with properties:
name: GeForce GTX 1080 major: 6 minor: 1 memoryClockRate(GHz): 1.7715
pciBusID: 0000:08:00.0
totalMemory: 7.93GiB freeMemory: 7.30GiB
2018-11-05 13:50:07.529910: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1484] Adding visible gpu devices: 0
2018-11-05 13:50:07.708551: I tensorflow/core/common_runtime/gpu/gpu_device.cc:965] Device interconnect StreamExecutor with strength 1 edge matrix:
2018-11-05 13:50:07.708587: I tensorflow/core/common_runtime/gpu/gpu_device.cc:971] 0
2018-11-05 13:50:07.708592: I tensorflow/core/common_runtime/gpu/gpu_device.cc:984] 0: N
2018-11-05 13:50:07.708786: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1097] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 7043 MB memory) -> physical GPU (device: 0, name: GeForce GTX 1080, pci bus id: 0000:08:00.0, compute capability: 6.1)
[kp] Loaded input normalizers for testing
WARNING:tensorflow:From /home/czdong/Desktop/tf-lift/layers.py:353: calling reduce_max (from tensorflow.python.ops.math_ops) with keep_dims is deprecated and will be removed in a future version.
Instructions for updating:
keep_dims is deprecated, use keepdims instead
WARNING:tensorflow:From /home/czdong/Desktop/tf-lift/layers.py:368: calling reduce_sum (from tensorflow.python.ops.math_ops) with keep_dims is deprecated and will be removed in a future version.
Instructions for updating:
keep_dims is deprecated, use keepdims instead

Variables: name (type shape) [size]

network/lift/kp/conv-ghh-1/weights:0 (float32_ref 25x25x1x16) [10000, bytes: 40000]
network/lift/kp/conv-ghh-1/biases:0 (float32_ref 16) [16, bytes: 64]
network/lift/desc/conv-act-pool-norm-1/weights:0 (float32_ref 7x7x1x32) [1568, bytes: 6272]
network/lift/desc/conv-act-pool-norm-1/biases:0 (float32_ref 32) [32, bytes: 128]
network/lift/desc/conv-act-pool-norm-2/weights:0 (float32_ref 6x6x32x64) [73728, bytes: 294912]
network/lift/desc/conv-act-pool-norm-2/biases:0 (float32_ref 64) [64, bytes: 256]
network/lift/desc/conv-act-pool-3/weights:0 (float32_ref 5x5x64x128) [204800, bytes: 819200]
network/lift/desc/conv-act-pool-3/biases:0 (float32_ref 128) [128, bytes: 512]
Total size of variables: 290336
Total bytes of variables: 1161344
Traceback (most recent call last):
File "main.py", line 98, in
tf.app.run(main=main, argv=[sys.argv[0]] + unparsed)
File "/home/czdong/anaconda3/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 125, in run
_sys.exit(main(argv))
File "main.py", line 67, in main
task = Tester(config, rng)
File "/home/czdong/Desktop/tf-lift/tester.py", line 88, in init
self.saver[_key] = tf.train.Saver(self.network.allparams[_key])
File "/home/czdong/anaconda3/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1281, in init
self.build()
File "/home/czdong/anaconda3/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1293, in build
self._build(self._filename, build_save=True, build_restore=True)
File "/home/czdong/anaconda3/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1330, in _build
build_save=build_save, build_restore=build_restore)
File "/home/czdong/anaconda3/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 756, in _build_internal
saveables = self._ValidateAndSliceInputs(names_to_saveables)
File "/home/czdong/anaconda3/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 656, in _ValidateAndSliceInputs
names_to_saveables = BaseSaverBuilder.OpListToDict(names_to_saveables)
File "/home/czdong/anaconda3/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 563, in OpListToDict
name)
ValueError: At least two variables have the same name: network/lift/kp/conv-ghh-1/biases

my cuda is
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2017 NVIDIA Corporation
Built on Fri_Sep__1_21:08:03_CDT_2017
Cuda compilation tools, release 9.0, V9.0.176

python3.6
opencv3.4.3

Is there anyone know how to solve this problem? Thank you very much.

Troubles with running test_kp*.sh

Hi there.

I got the following error when I ran either test_kp.sh or test_kp_legacy.sh:

 File "/tf-lift/tester.py", line 88, in __init__
   self.saver[_key] = tf.train.Saver(self.network.allparams[_key])
ValueError: At least two variables have the same name: network/lift/kp/conv-ghh-1/biases

All code were intact, and no pre-trained model was added. Is it a bug of the code?

is the descriptors matched by the standard vl_ubcmatch?

Hi, I'm wondering what method you used to match the descriptors? Is it the standard vl_ubcmatch()? I want to ask this because the output descriptors are not [0-255] integers, which a lot of software takes. I don't know whether it affects anything. Thank you so much!

Runtime error while testing

Hello,

I am getting the following error every time i am trying to run one of the command in testing:-

python main.py --task=test --subtask=ori --logdir=logs/test --test_img_file=image1.jpg --test_out_file=image1_ori.txt --test_kp_file=image1_kp.txt --use_batch_norm=False
/home/user/anaconda2/envs/tf/lib/python3.5/site-packages/h5py/init.py:36: FutureWarning: Conversion of the second argument of issubdtype from float to np.floating is deprecated. In future, it will be treated as np.float64 == np.dtype(float).type.
from ._conv import register_converters as _register_converters
User and hostname: user@8RM7KY3
2018-07-06 18:54:33.866125: I tensorflow/core/platform/cpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX
-- Using default values for mean/std

Variables: name (type shape) [size]

network/lift/ori/conv-act-pool-1/weights:0 (float32_ref 5x5x1x10) [250, bytes: 1000]
network/lift/ori/conv-act-pool-1/biases:0 (float32_ref 10) [10, bytes: 40]
network/lift/ori/conv-act-pool-2/weights:0 (float32_ref 5x5x10x20) [5000, bytes: 20000]
network/lift/ori/conv-act-pool-2/biases:0 (float32_ref 20) [20, bytes: 80]
network/lift/ori/conv-act-pool-3/weights:0 (float32_ref 3x3x20x50) [9000, bytes: 36000]
network/lift/ori/conv-act-pool-3/biases:0 (float32_ref 50) [50, bytes: 200]
network/lift/ori/fc-ghh-drop-4/weights:0 (float32_ref 1250x1600) [2000000, bytes: 8000000]
network/lift/ori/fc-ghh-drop-4/biases:0 (float32_ref 1600) [1600, bytes: 6400]
network/lift/ori/fc-ghh-5/weights:0 (float32_ref 100x32) [3200, bytes: 12800]
network/lift/ori/fc-ghh-5/biases:0 (float32_ref 32) [32, bytes: 128]
network/lift/desc/conv-act-pool-norm-1/weights:0 (float32_ref 7x7x1x32) [1568, bytes: 6272]
network/lift/desc/conv-act-pool-norm-1/biases:0 (float32_ref 32) [32, bytes: 128]
network/lift/desc/conv-act-pool-norm-2/weights:0 (float32_ref 6x6x32x64) [73728, bytes: 294912]
network/lift/desc/conv-act-pool-norm-2/biases:0 (float32_ref 64) [64, bytes: 256]
network/lift/desc/conv-act-pool-3/weights:0 (float32_ref 5x5x64x128) [204800, bytes: 819200]
network/lift/desc/conv-act-pool-3/biases:0 (float32_ref 128) [128, bytes: 512]
Total size of variables: 2299482
Total bytes of variables: 9197928

Loading Trained Network

[joint] Checking if old pre-trained weights exists in
[joint] No pretrained weights from the old framework
[joint] Checking if previous Tensorflow run exists in
[joint] No previous Tensorflow result
[joint] Checking if previous Tensorflow run exists in logs/test/joint
[joint] No previous Tensorflow result
[ori] Checking if old pre-trained weights exists in
[ori] No pretrained weights from the old framework
[ori] Checking if previous Tensorflow run exists in
[ori] No previous Tensorflow result
[ori] Checking if previous Tensorflow run exists in logs/test/ori
[ori] No previous Tensorflow result
Traceback (most recent call last):
File "main.py", line 98, in
tf.app.run(main=main, argv=[sys.argv[0]] + unparsed)
File "/home/user/anaconda2/envs/tf/lib/python3.5/site-packages/tensorflow/python/platform/app.py", line 48, in run
_sys.exit(main(_sys.argv[:1] + flags_passthrough))
File "main.py", line 70, in main
task.run()
File "/media/user/SSD-0/Linux/Projects/TF_LIFT/tf-lift-master/tester.py", line 110, in run
raise RuntimeError("Could not load network weights!")
RuntimeError: Could not load network weights!

I am using Tensorflor 1.4, Cuda 8, opencv3.4. tensorboard 0.4. Any suggestions to resolve this error, will be very helpful.

Thanks in advance.

Activation for DESC is 'relu' rather than 'Tanh' in config.py by default

Excuse me, I have a question for the LIFT network implementation.
I found the supplementary description of your LIFT paper as:
LIFT_Structure

In the picture you set the Activation for DESC part as Tanh. However:
I noticed that in your config.py you set config.desc_activ as 'relu' as default setting.
Then in your modules/lift_desc.py, from Line 69 to Line 75 the activation for DESC part will set to ''relu" if I run the python scripts as default setting.

Is it a wrong setting in the code? Or the activation of relu or Tanh does not matter so much in DESC part?
Or did I miss some setting changes in another place?

What is the structure of the split-#-#-#-minsc-2.0.h5 file?

I'm working on a created a documented training dataset pipeline for this network to see how different datasets might induce different learning outcomes, and I've been able to follow the process for generating training data using VisualSFM fairly well with some educated guesses combined with the descriptions in the paper and code documentation, which is pretty good. I am attempting to recreate the training pipeline as closely as possible to the original work with some additional documentation which I would not mind turning into a PR once it is finished and I know that I've got it right.

However, there is a hole regarding this section:

 # Use only valid indices to ascertain mutual exclusiveness
                id_file_name = train_data_dir + "split-"
                id_file_name += str(param.dataset.nTrainPercent) + "-"
                id_file_name += str(param.dataset.nValidPercent) + "-"
                id_file_name += str(param.dataset.nTestPercent) + "-"
                id_file_name += ("minsc-" +
                                 str(param.dataset.fMinKpSize) +
                                 ".h5")

                if mode == "train":
                    id_key = "indices_train"
                elif mode == "valid":
                    id_key = "indices_val"
                elif mode == "test":
                    id_key = "indices_test"
                print(id_file_name)
                with h5py.File(id_file_name, "r") as id_file:
                    id_2_keep = np.asarray(id_file[id_key])

                # ind_2_keep = np.in1d(dataset[2], id_2_keep)
                # ind_2_keep += dataset[2] < 0

                # loop through files to figure out how many valid items we have
#                pdb.set_trace() # for tracking of the dataset

This collection of valid indices and the concept of mutually excluding data is not referred to anywhere in the paper or elsewhere in the code, or if it is I cannot find it. I can tell by the name it is supposed to be some collection of ids for point features (my guess would be for SfM pointids?), but given its location in the code it is unclear how those values would be determined. Also, the access section for the dump files:

# Use loadh5 and turn it back to original cur_data_set
                    with h5py.File(final_dump_file_name, "r") as dump_file:
                        cur_ids = dump_file["2"].value

before the comparison is done has no obvious correlation with the "valid_keypoints" and "other_keypoints" keys in the kp-minsc files, so I'm drawing a blank as to what those values could be.

Could someone who is familiar with these files provide:

  1. A quick overview of how the split-#-#-#-minsc-2.0.h5 valid indices are determined for a data-subset?
  2. A short breakdown of the structure of the dump files to make sure that I am not missing any additional components they require?

Thanks,
4xle

I wonder a question: why LIFT performs so better than SIFT?

Excuse me, I am sorry to bother you with the theoretical question.

During the LIFT pipeline, you got 4 patches based on VSFM, which is the patches samples label tool.
The VSFM performs reconstruction with SIFT.

I an not sure about: Why the SIFT based training data can work so better than SIFT? Also better than the state-of-the-art methods.

Is it from the score map in KP part network?

Lift features not uint8

Dear all,

I am surprised to see that the LIFT features are not uint8 but float.

This is quite surprising as SIFT is usually of uint8 type. I understand that they are not between 0-255, as some normalization has probably been applied before training.

However, I am usually using uint8 features. Will I lose precision by converting LIFT features to uint8 ?

Thanks

! Problems in running main.py

Hi, thank you for sharing this fabulous code!
I've encountered some problems while executing
python main.py --task=train --subtask=desc

The error message is down below:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/flufl/lock/_lockfile.py", line 202, in lock
    os.link(self._claimfile, self._lockfile)
OSError: [Errno 38] Function not implemented: '.locks/setup.lock|39a239ed6eba|972|4773241702466798304' -> '.locks/setup.lock'
Traceback (most recent call last):
  File "main.py", line 98, in <module>
    tf.app.run(main=main, argv=[sys.argv[0]] + unparsed)
  File "/usr/local/lib/python3.7/dist-packages/tensorflow/python/platform/app.py", line 40, in run
    _run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef)
  File "/usr/local/lib/python3.7/dist-packages/absl/app.py", line 303, in run
    _run_main(main, args)
  File "/usr/local/lib/python3.7/dist-packages/absl/app.py", line 251, in _run_main
    sys.exit(main(argv))
  File "main.py", line 59, in main
    task = Trainer(config, rng)
  File "/content/drive/My Drive/ColabNotebooks/stitching/tf-lift/trainer.py", line 71, in __init__
    self.dataset = Dataset(self.config, rng)
  File "/content/drive/My Drive/ColabNotebooks/stitching/tf-lift/datasets/lift.py", line 85, in __init__
    self.data_wrapper = self.data_module.Wrapper(config, rng)
  File "/content/drive/My Drive/ColabNotebooks/stitching/tf-lift/datasets/eccv2016/wrapper.py", line 107, in __init__
    old_data = old_impl.data_obj(param, task)
  File "/content/drive/My Drive/ColabNotebooks/stitching/tf-lift/datasets/eccv2016/eccv.py", line 242, in __init__
    self.load_data(param, mode)
  File "/content/drive/My Drive/ColabNotebooks/stitching/tf-lift/datasets/eccv2016/eccv.py", line 263, in load_data
    pathconf.setupTrain(param, param.dataset.trainSetList[idxSet])
  File "/content/drive/My Drive/ColabNotebooks/stitching/tf-lift/datasets/eccv2016/custom_types.py", line 146, in setupTrain
    lock.lock()
  File "/usr/local/lib/python3.7/dist-packages/flufl/lock/_lockfile.py", line 202, in lock
    os.link(self._claimfile, self._lockfile)
OSError: [Errno 38] Function not implemented: '.locks/setup.lock|39a239ed6eba|972|4773241702466798304' -> '.locks/setup.lock'
Exception ignored in: <function Lock.__del__ at 0x7f2db90e8cb0>
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/flufl/lock/_lockfile.py", line 319, in __del__
  File "/usr/local/lib/python3.7/dist-packages/flufl/lock/_lockfile.py", line 314, in finalize
  File "/usr/local/lib/python3.7/dist-packages/flufl/lock/_lockfile.py", line 271, in unlock
  File "/usr/local/lib/python3.7/dist-packages/flufl/lock/_lockfile.py", line 298, in is_locked
  File "/usr/local/lib/python3.7/dist-packages/flufl/lock/_lockfile.py", line 447, in _touch
ImportError: sys.meta_path is None, Python is likely shutting down

  • p.s. Installed modules with python3.7 are:
  • numpy, h5py, tensorflow==1.14, tensorflow-gpu==1.14
  • parse, flufl.lock==3

Can someone help me solve this problem? Thanks a lot!

train the netWork

Do I need to use visualSFM the reconstruct the image in 3D?
Or all I do is just to down load the image "Piccadilly
Circus in London and the Roman Forum in Rome from [29]" to train the network?
I mean what should I do to prepare the datasets ?

thanks for your attention.

get both keypoints and descriptors in one function call.

Hello, thank you very much for sharing tf version of LIFT.

The question is:

In tester we got three possible subtasks for which of them we got model to download, many the functions in tester works taking in account config.subtask value.

So let`s say I want to obtain descriptors, then I should first launch tester with subtask=='kps' and get keypoints, then with subtask=='ori' and get them with orientations, and finally I should launch tester with subtask=='desc' and compute descriptors from image and keypoints from previous('ori') launch.

So I`ll need to reinitialize tester 3 times or at least tester.network and tester.subtask attributes.
Which is not handy.

Is there someway to obtain both keypoints and descriptor from one object via method call and without reinitializing tester few times in a row? Something like:

lift = LIFT()
kps, desc =lift.get_kps_n_desc(img) 

scales-histogram-minsc-2

When I run: main.py --task=train --subtask=desc

I get this error : OSError: Unable to open file (Unable to open file: name = '/users/test/datasets/eccv/piccadilly/scales-histogram-minsc-2.0.h5', errno = 2, error message = 'no such file or directory', flags = 0, o_flags = 0)

Does any one know why that is?

No module named flufl.lock

WHen I try to run the command, ' main.py --task=train --subtask=desc' I get the following error.

File "/home/uzair/tensorflow/tf-lift/datasets/eccv2016/eccv.py", line 55, in
from flufl.lock import Lock
ImportError: No module named flufl.lock

I tried to install this package but that is leading to more errors. How do I install this package? should I do it with pip? Does the lift code base require any particular version of python like python3 or python3.4?

missing scales-histogram-minsc-2.0.h5

Hi, I try to run the command python main.py --task=main --subtask=desc.
But it always produces the error saying that can not open file scales-histogram-minsc-2.0.h5, which does not exist in any of the folders. May I know where to download the dataset?
Sorry for bothering with this naive problem. Thank you very much!

missing file: lift_desc_sub_kernel.h5

After studying the code for a bit, I think I am able to load in the legacy models contained in the original LIFT repo. However, when trying to run the "kp" subtask on a test image, I get an OSError at line 67 in "modules/lift_desc.py" due to the missing file "tf-lift/modules/lift_desc_sub_kernel.h5". Would it be possible to include it in the repo? Thanks.

Dockerfile

Hi

I've made a docker file that contains all of your code and dependencies.

docker pull fremmen/tf-lift

Are the pretrained models provided?

Are the pretrained models provided?
I didn't find the pretrained models in the repo and when trying out the testing samples, it seems that the models are missing?
Thank you!

How to choose descriptor thresholds for NNmAP and matching score across the methods evaluated in your bench ?

Hello,

First thank you for releasing the code. I read the paper where you choose the metrics to be repeatability, NNmAP and matching score. You run extensive experiments on several methods which descriptor dimension, range and even semantic meanings (ORB for example uses binary descriptor) changes. I am looking for a way to choose the descriptor thresholds used in NNmAP and matching score definition that would be consistent for all the methods. Could you recommend me some resources or explain me how to do it please ?

Thank you in advance.

Reproduce images matching of your publication

Hi, I saw your publication about the matching keypoints/descriptors of skull's image. The result are impressive and I would like to reproduce it, but I am not able to do it.

I have converted the keypoints list of both images to OpenCV format thanks to the kp_list_2_opencv_kp_list() function, but I don't know how to match the descriptors. Does the descriptors are compatible with OpenCV format to use cv2.BFMatcher().match(desc1, desc2) ?
Or maybe you used antoher way to match images...

Thank you!

LIFT feature matching

Hi,can you show me a demo about the LIFT feature match.For I want compare it with other features and demonstrate the roboutness of LIFT in varying conditions.
Looking forward your reply,thank you.

How can i get the training images and testing images

I try to use pip command to configure the project and i meet the problem"PermissionError: [Errno 13] Permission denied: '/cvlabdata2'" .
Then , I open the config.py and find the reason."/cvlabdata2/home/{}/Datasets/" is default path.
My request is as follows:

  1. Can you upload some datasets include training imags and testing images?
  2. Write an requirements.txt for user to use with pip

Thank you for your help

tidy up of tf-lift and lift => how to train test, or run pretrained model

Hi,
I could not run tf-lift no matter I will train or run pretrain, I followed lots of pre-issues:

  1. Train with raw data is not supported?
  • Need read code to wrap raw dataset to h5 file?
    #9
    linke mentioned: You can look into datasets/eccv2016.py
  • Unable to open file scales-histogram-minsc-2.0.h5
    #5
    Need read code and wrap data to scales-histogram-minsc-2.0.h5? But that is just training, could I train without this file?
  1. Test:Need find LIFT repo
    However I find LIFT not able to run for it needs old Theano and old cuda...

My question is I am new to this area, and now is 2019, not reasonable to require support of a 2016 paper code. Could you just give some advise are there new projects that worth to follow? I am finding work that like LIFT, find better key point and image match than OpenCV.

Great thanks!

How to download data?

Hi, guys,
Could someone tell me where to download the required dataset (Piccadily?) and or something else to get the codes running?
Thanks,
Xudong

Is there any Python demo to read the .sift file from VisualSFM?

After VisualSFM each image will generate a sift file and the SIFT feature points descriptors data is in the file. 
It seems vital to get the descriptors into h5 files as "img-kp-minsc-2.0.h5" files to finish LIFT training pre-processing. 

However,  the sift files from VisualSFM are binary files and according to: http://ccwu.me/vsfm/doc.html#usage
The sift files are in the format in description in **"Use your own feature detectors"** part as follows:

[Header][Location Data][Descriptor Data][EOF]
[Header] = int[5] = {name, version, npoint, 5, 128};
name = ('S'+ ('I'<<8)+('F'<<16)+('T'<<24));
version = ('V'+('4'<<8)+('.'<<16)+('0'<<24)); or ('V'+('5'<<8)+('.'<<16)+('0'<<24)) if containing color info
npoint = number of features.

[Location Data] is a npoint x 5 float matrix and each row is [x, y, color, scale, orientation].
Write color by casting the float to unsigned char[4]
scale & orientation are only used for visualization, so you can simply write 0 for them

  • Sort features in the order of decreasing importance, since VisualSFM may use only part of those features.
  • VisualSFM sorts the features in the order of decreasing scales.

[Descriptor Data] is a npoint x 128 unsigned char matrix. Note the feature descriptors are normalized to 512.

[EOF] int eof_marker = (0xff+('E'<<8)+('O'<<16)+('F'<<24));

But I still can not understand the instruction.
How to read the sift file properly in Python code?
What is the encoding parameter of the open("r", encoding) function? 'utf-8' is not right to read the sift files.
I tried encoding='utf-16' but also failed.

With the help of Notepad++ Hex-Editor plugin, I understand the [Header] part but I still can not work out the rest parts.
Can someone help me with the sift file data reading with Python? Thanks a lot!

How to visualize the train loss and accuracy curve while training?

Hello,I have finished training pre-processing code and got the training available for desc, ori and kp subtasks.

But in utils/dump.py I noticed that you only did best_validation loss and iteration step(also with std.h5 and mean.h5) record in the training result.

I am new to the tensorflow model code. I wonder: Are there any approaches to make the train loss and accuracy(If available) for visualization.
Thanks for help.

Unable to open file:split-60-20 -20-minsc-2.0.h5

For this time,I dont know how to fix it.Help me please.
Unable to open file:split-60-20 -20-minsc-2.0.h5
I can get scales-histogram-minsc-2.0.h5,but I dont konw how to get split-60-20 -20-minsc-2.0.h5.
image

Is the Triplet loss better than the Hinge embedding loss in the DESC part?

Excuse me, I come again for the implementation of LIFT code which seems different from the way you mentioned in the paper.

In the DESC part, you designed the loss function as :
loss_paper

Then in your code, you set config.use_triplet_loss as True by default.
Then you did the losses implementation both of hinge loss and triplet loss in losses.py.
You set the triplet loss by default.
Did the triplet loss in DESC work better than the hinge loss in your previous experiment before the repo published?

I tested both but the result seems unchanged, but due to my data amount the training model result was poor.
So I came for the question.

What is the latest development of LIFT? Is it being under improvement?

Dear Professor,

I am currently a master student learning computer vision as my main field and I have recently read your paper released in 2016 about Learned Invariant Feature Transform (LIFT). After reading through the whole paper, I was really impressed with the idea and also the performance of LIFT when it could drastically beat other traditional detectors in terms of accuracy. However, it is quite a surprise to me that I do not see the development of it today meaning it is not included in image processing libraries such as open CV and people are also not discussing its potential anymore.
For that reason, may you please give me some insights about what are the weaknesses and difficulty of this method stopping it from developing today?
I would love to hear your response soon!

Thanks and best regards!
Phuong

Model without rotation augmentation

Hi,

I am trying to test the pre-trained models on a given image.
I am able to use the model with rotation augmentation:

python main.py --task=test --subtask=kp --test_img_file=image1.jpg --test_out_file=image1_kp.txt --pretrained_kp=MODELS/release-aug/kp --use_batch_norm=False --mean_std_type=hardcoded --logdir=logs/test

However I get an error when I try to use the model without rotation augmentation:

python main.py --task=test --subtask=kp --test_img_file=image1.jpg --test_out_file=image1_kp.txt --pretrained_kp=MODELS/release-no-aug/kp --use_batch_norm=False --mean_std_type=dataset --logdir=logs/test
[...]
-- Recomputing dataset mean/std...
Traceback (most recent call last):
  File "main.py", line 108, in <module>
    tf.app.run(main=main, argv=[sys.argv[0]] + unparsed)
  File "/tensorflow1.4/local/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 48, in run
    _sys.exit(main(_sys.argv[:1] + flags_passthrough))
  File "main.py", line 77, in main
    task = Tester(config, rng)
  File "tf-lift/tester.py", line 81, in __init__
    self.network = Network(self.sess, self.config, self.dataset)
  File "tf-lift/networks/lift.py", line 99, in __init__
    _d = self.dataset.data["train"]["patch"][:, :, :, :]
AttributeError: 'Dataset' object has no attribute 'data'

The problem comes from the mean_std_type=dataset option. With the other mean_std_type, it seems ok.

Do I have to specify something else ?

I see the files mean.h5 and std.h5 in MODELS/release-no-aug/kp.

Thanks,
Boris.

Is there any related test code for Matching Score?

Thank you for your great work.

I found that in the paper you use the matching score as an evaluation metric.

I wonder is there any code available to calculating the Matching Score? Or any test code about this so that I can double-check?

Also, is there any available library related with LIFT available on the mobile platform?

Thank you very much.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.