Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get both keypoints and descriptors in one function call. #34

Open
MoZZez opened this issue Dec 18, 2018 · 5 comments
Open

get both keypoints and descriptors in one function call. #34

MoZZez opened this issue Dec 18, 2018 · 5 comments

Comments

@MoZZez
Copy link

MoZZez commented Dec 18, 2018

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) 
@qiuweibo
Copy link

qiuweibo commented Apr 8, 2019

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) 

It is the task I am working on. I was thinking to write a python script and call subtask kps, ori and desc one by one.

@coolbeam
Copy link

`
class Sys_command():
class Clock():
def init(self):
self.st = 0
self.en = 0

    def start(self):
        self.reset()
        self.st = time.time()

    def reset(self):
        self.st = 0
        self.en = 0

    def end(self):
        self.en = time.time()

    def get_during(self):
        return self.en - self.st
@classmethod
def demo(cls):
    os.system('ls')

@classmethod
def demo_python(cls):
    print('python lift_runner.py')
    os.system('python lift_runner.py')

@classmethod
def python_command(cls, command='ls'):
    os.system(command)

@classmethod
def main_lift_release_aug(cls, img_path, kp_txt, ori_txt, desc_h5):
    run_kp = 'python main.py --task=test --subtask=kp --logdir=release-aug --test_img_file=%s --test_out_file=%s --use_batch_norm=false --mean_std_type=hardcoded'
    run_kp = run_kp % (img_path, kp_txt)

    run_ori = 'python main.py --task=test --subtask=ori --logdir=release-aug --test_img_file=%s --test_out_file=%s --test_kp_file=%s  --use_batch_norm=false --mean_std_type=hardcoded'
    run_ori = run_ori % (img_path, ori_txt, kp_txt)

    run_desc = 'python main.py --task=test --subtask=desc --logdir=release-aug --test_img_file=%s --test_out_file=%s --test_kp_file=%s  --use_batch_norm=false --mean_std_type=hardcoded'
    run_desc = run_desc % (img_path, desc_h5, ori_txt)

    cls.python_command(run_kp)
    cls.python_command(run_ori)
    cls.python_command(run_desc)

@classmethod
def demo_lisf(cls):
    # cp /deep_homo_test/lift_runner.py  /tf-lift/
    clock = Clock()
    clock.start()
    lift_test_root = '/deep_homo_test'
    img_path = os.path.join(lift_test_root, 'demo.JPG')
    kp_txt = os.path.join(lift_test_root, 'demo_kp.txt')
    ori_txt = os.path.join(lift_test_root, 'demo_ori.txt')
    desc_h5 = os.path.join(lift_test_root, 'demo_desc.h5')
    cls.main_lift_release_aug(img_path, kp_txt, ori_txt, desc_h5)
    clock.end()
    print('=' * 5 + ' use time: %ss' % clock.get_during())`

@ZhixiongSun
Copy link

@coolbeam hey coolbeam, I am working on Lift now. Could you please send me the script you refered so that I can get both keypoints and descriptors in one function call.

Thanks a lot for you help

@coolbeam
Copy link

@coolbeam hey coolbeam, I am working on Lift now. Could you please send me the script you refered so that I can get both keypoints and descriptors in one function call.

Thanks a lot for you help

Hi, The code is provided in the previous reply. This is done by using os.system('command to call kp, ori and desc').

@ZeroSteven618
Copy link

@ZhixiongSun ,
You can get help from:
https://github.com/4xle/tf-lift/blob/master/run_test_pass_on_image.py
which is from the PR from @4xle.

It is available by from subprocess import run to run several python scripts in a shell in order.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants