hughw19 / NOCS_CVPR2019

[CVPR2019 Oral] Normalized Object Coordinate Space for Category-Level 6D Object Pose and Size Estimation on Python3, Tensorflow, and Keras
https://geometry.stanford.edu/projects/NOCS_CVPR2019/
Other
453 stars 72 forks source link

TypeError: only integer scalar arrays can be converted to a scalar index #40

Closed vtasStu closed 3 years ago

vtasStu commented 3 years ago

hi, I am trying to run train.py, but I get this error: """ Traceback (most recent call last): File "/root/Workspace/project/nocs/model.py", line 3077, in data_generator load_image_gt(dataset, config, image_id, augment=augment, use_mini_mask=config.USE_MINI_MASK) File "/root/Workspace/project/nocs/model.py", line 2587, in load_image_gt image, mask, coord, class_ids, scales, domain_label = dataset.load_augment_data(image_id) File "/root/Workspace/project/nocs/dataset.py", line 502, in load_augment_data image = self.load_image(image_id) File "/root/Workspace/project/nocs/dataset.py", line 246, in load_image image = cv2.imread(image_path)[:, :, :3] TypeError: 'NoneType' object is not subscriptable

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/root/Workspace/anaconda3/envs/nocs/lib/python3.5/multiprocessing/pool.py", line 119, in worker result = (True, func(*args, **kwds)) File "/root/Workspace/anaconda3/envs/nocs/lib/python3.5/site-packages/keras/utils/data_utils.py", line 650, in next_sample return six.next(_SHARED_SEQUENCES[uid]) File "/root/Workspace/project/nocs/model.py", line 3174, in data_generator logging.exception("Error processing image {}".format(dataset.image_info[draw_source_ids])) TypeError: only integer scalar arrays can be converted to a scalar index """

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "train.py", line 207, in layers_name='heads') File "/root/Workspace/project/nocs/model.py", line 4239, in train self.keras_model.fit_generator(train_generator, initial_epoch=self.epoch, epochs=epochs, *fit_kwargs) File "/root/Workspace/anaconda3/envs/nocs/lib/python3.5/site-packages/keras/legacy/interfaces.py", line 91, in wrapper return func(args, *kwargs) File "/root/Workspace/anaconda3/envs/nocs/lib/python3.5/site-packages/keras/engine/training.py", line 1732, in fit_generator initial_epoch=initial_epoch) File "/root/Workspace/anaconda3/envs/nocs/lib/python3.5/site-packages/keras/engine/training_generator.py", line 185, in fit_generator generator_output = next(output_generator) File "/root/Workspace/anaconda3/envs/nocs/lib/python3.5/site-packages/keras/utils/data_utils.py", line 742, in get six.reraise(sys.exc_info()) File "/root/Workspace/anaconda3/envs/nocs/lib/python3.5/site-packages/six.py", line 703, in reraise raise value File "/root/Workspace/anaconda3/envs/nocs/lib/python3.5/site-packages/keras/utils/data_utils.py", line 711, in get inputs = future.get(timeout=30) File "/root/Workspace/anaconda3/envs/nocs/lib/python3.5/multiprocessing/pool.py", line 644, in get raise self._value TypeError: only integer scalar arrays can be converted to a scalar index

Cloud you please to tell me how to fix it?

vtasStu commented 3 years ago

I have solve this problem by commenting : logging.exception("Errorprocessing image {}".format(dataset.image_info[draw_source_ids])) in the last except,because draw_source_ids is a np.ndarray. But there are alse something wrong, I don't know if the error is in the dataset or in the generator code

liupenglei commented 3 years ago

I have solve this problem by commenting : logging.exception("Errorprocessing image {}".format(dataset.image_info[draw_source_ids])) in the last except,because draw_source_ids is a np.ndarray. But there are alse something wrong, I don't know if the error is in the dataset or in the generator code

Have you solved this problem? I also encountered the same problem. How did you solve it?