lmb-freiburg / netdef_models

Repository for different network models related to flow/disparity (ECCV 18)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Controller eval code wrong in readme (part 2)

franciscorba opened this issue · comments

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)

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[...],
              ])