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

Controller eval code wrong in readme (part 2) #11

Open
franciscorba opened this issue Dec 18, 2018 · 1 comment
Open

Controller eval code wrong in readme (part 2) #11

franciscorba opened this issue Dec 18, 2018 · 1 comment

Comments

@franciscorba
Copy link

franciscorba commented Dec 18, 2018

out = c.net_actions.eval(img0, img1) returns:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: eval() missing 1 required positional argument: 'image_1'

(using tried with img0 and img1 as path to the image and as numpy array)

@AziziShekoofeh
Copy link

The problem is coming from the fact that self.net_actions=NetAction class is not initialized correctly. So, to solve this issue change the eval code like this:

import netdef_slim as nd

img0 = 'path to image 0 path'
img1 = 'path to image 1 path'

c_model = nd.load_module(path='full path to controller.py, avoid the relational path')
c = c_model.Controller() 
c_net = c.net_actions(net_dir=c.base_path)
out = c_net.eval(img0, img1)
out_flow = out['flow[0].fwd'][0]
# You can use flowlib.py/flow_to_image() from FlowNet2 or other packages to visualize the results. 
# Don't forget to do the dimension correction. Curent dimension are [2,w,h] and 2 for (u,v) pairs

# out is an OrderedDict with the following structure
#OrderedDict(['flow[0].fwd',     np.array[...],
              'occ[0].fwd',      np.array[...],
              'occ_soft[0].fwd', np.array[...],
              'mb[0].fwd',       np.array[...],
              'mb_soft[0].fwd',  np.array[...],
              ])

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

2 participants