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

Errors in train generator #46

Closed
CMXB opened this issue May 24, 2018 · 2 comments
Closed

Errors in train generator #46

CMXB opened this issue May 24, 2018 · 2 comments

Comments

@CMXB
Copy link

CMXB commented May 24, 2018

Problem description

[sample_batch_train_data, sample_batch_test_data] = next(train_generator)
this line in TrainModel results in an axis error, and I can't figure this out

Problem details


AxisError Traceback (most recent call last)
in ()
24 plt.show()
25
---> 26 [sample_batch_train_data, sample_batch_test_data] = next(train_generator)
27 for i in range(0, 3, 1):
28 draw_image_with_label(sample_batch_train_data[0][i], sample_batch_test_data[i])

E:\software\anaconda\lib\site-packages\keras\preprocessing\image.py in next(self, *args, **kwargs)
1067
1068 def next(self, *args, **kwargs):
-> 1069 return self.next(*args, **kwargs)
1070
1071 def _get_batches_of_transformed_samples(self, index_array):

E:\Projects\Autonomous driving\Code\jupyter\AutonomousDrivingCookbook\AirSimE2EDeepLearning\Generator.py in next(self)
240 # so it can be done in parallel
241
--> 242 return self.__get_indexes(index_array)
243
244 def __get_indexes(self, index_array):

E:\Projects\Autonomous driving\Code\jupyter\AutonomousDrivingCookbook\AirSimE2EDeepLearning\Generator.py in __get_indexes(self, index_array)
262 x_images = x_images[self.roi[0]:self.roi[1], self.roi[2]:self.roi[3], :]
263
--> 264 transformed = self.image_data_generator.random_transform_with_states(x_images.astype(K.floatx()))
265 x_images = transformed[0]
266 is_horiz_flipped.append(transformed[1])

E:\Projects\Autonomous driving\Code\jupyter\AutonomousDrivingCookbook\AirSimE2EDeepLearning\Generator.py in random_transform_with_states(self, x, seed)
138 x = image.random_channel_shift(x,
139 self.channel_shift_range,
--> 140 img_channel_axis)
141 if self.horizontal_flip:
142 if np.random.random() < 0.5:

E:\software\anaconda\lib\site-packages\keras\preprocessing\image.py in random_channel_shift(x, intensity, channel_axis)
188
189 """
--> 190 x = np.rollaxis(x, channel_axis, 0)
191 min_x, max_x = np.min(x), np.max(x)
192 channel_images = [np.clip(x_channel + np.random.uniform(-intensity, intensity), min_x, max_x)

E:\software\anaconda\lib\site-packages\numpy\core\numeric.py in rollaxis(a, axis, start)
1440 """
1441 n = a.ndim
-> 1442 axis = normalize_axis_index(axis, n)
1443 if start < 0:
1444 start += n

AxisError: axis 3 is out of bounds for array of dimension 3

Exepriment/Environment details

  • Tutorial used: AirSimE2EDeepLearning
  • Environment used: landscape
@CMXB
Copy link
Author

CMXB commented May 24, 2018

I forget to look the closed issue, please close this

@adshar adshar closed this as completed May 25, 2018
@lvhualong
Copy link

I also got this problem, did you have figured this out?

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

3 participants