LouisFoucard / w-net

w-net: a convolutional neural network architecture for the self-supervised learning of depthmap from pairs of stereo images.
204 stars 47 forks source link

Problem in the generator named 'data_generator' and the corresponding generators in 'data_loader.py' file #6

Open ShubhayuDas opened 6 years ago

ShubhayuDas commented 6 years ago

I got an error at the very last section of the w_net_walk_through.ipynb file :

  2 depthmaps = []
  3 for i in tqdm(range(1)):

----> 4 dat = data_generator.next() 5 6 disparity_map_left, disparity_map_right = disp_maps_forward.predict(dat[0][0:10])

AttributeError: 'generator' object has no attribute 'next'

After going through https://stackoverflow.com/questions/1073396/is-generator-next-visible-in-python-3-0 , I found that on python 3 you need to use data_generator.next() or next(data_generator).

Note: I had to change this in the walk_through.ipynb file and the data_loader.py file as well

But even after this I get a Type Error:

TypeError: 'float' object cannot be interpreted as an integer

Here is the output:

TypeError Traceback (most recent call last)

in () 2 depthmaps = [] 3 for i in tqdm(range(1)): ----> 4 dat = data_generator.__next__() 5 6 disparity_map_left, disparity_map_right = disp_maps_forward.predict(dat[0][0:10]) ~/PycharmProjects/tensorplay/venv/w-net-master/data_loader.py in train_generator_func() 50 def train_generator_func(): 51 while True: ---> 52 X = train_generator1.__next__(self) 53 Y1 = train_generator2.__next__(self) 54 yield X, [Y1, np.zeros(shape=(Y1.shape[0], img_rows - 4, img_cols - 4)), ~/PycharmProjects/tensorplay/venv/lib/python3.6/site-packages/keras_preprocessing/image.py in next(self) 1817 # The transformation of images is not under thread lock 1818 # so it can be done in parallel -> 1819 return self._get_batches_of_transformed_samples(index_array) ~/PycharmProjects/tensorplay/venv/lib/python3.6/site-packages/keras_preprocessing/image.py in _get_batches_of_transformed_samples(self, index_array) 1763 batch_x = np.zeros( 1764 (len(index_array),) + self.image_shape, -> 1765 dtype=backend.floatx()) 1766 # build batch of image data 1767 for i, j in enumerate(index_array): TypeError: 'float' object cannot be interpreted as an integer ------------------------------------------------------------------------------------------------------ I am unable to fix this. Please help..
tv12345 commented 6 years ago

Managed to solve it by downgrading numpy to 1.11.0.