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

SystemError: <built-in function imread> returned NULL without setting an error #75

Open
SlowMonk opened this issue May 28, 2020 · 0 comments

Comments

@SlowMonk
Copy link

def func(images):
    images = np.array(images)
    newSize = [300,300]
    print('image_A->',images[0])
    #print('boxes->',boxes)


    image = cv2.imread(images[0])
    print(image)

    scale_x = newSize[0] / image.shape[1]
    scale_y = newSize[1] / image.shape[0]
    image = cv2.resize(image, (newSize[0], newSize[1]))
    return image

def train():
    print(tf.__version__)

    images,boxes,labels,difficulties= PascalVOCDataset()
    boxes = tf.ragged.constant(boxes)
    dataset = tf.data.Dataset.from_tensor_slices((images,boxes)).shuffle(100).batch(1)
    dataset = dataset.map(lambda image,box: tf.py_function(func=func, inp = [image],Tout=tf.string))



    #print(dataset)
    #dataset = dataset.map(func)

    for image,box in dataset:
        break


def main():
    train()
if __name__ =='__main__':
    main()

image_A-> b'/media/jake/mark-4tb3/input/datasets/pascal/VOCtrainval_11-May-2012/VOCdevkit/VOC2012/JPEGImages/2008_000259.jpg'
2020-05-28 22:28:27.374154: W tensorflow/core/framework/op_kernel.cc:1610] Unknown: SystemError: returned NULL without setting an error
Traceback (most recent call last):

File "/home/jake/venv/lib/python3.7/site-packages/tensorflow_core/python/ops/script_ops.py", line 219, in call
return func(device, token, args)

File "/home/jake/venv/lib/python3.7/site-packages/tensorflow_core/python/ops/script_ops.py", line 113, in call
ret = self._func(*args)

File "/home/jake/Gits/ssd_tensorflow/train.py", line 21, in func
image = cv2.imread(images[0])

SystemError: returned NULL without setting an error

2020-05-28 22:28:27.374302: W tensorflow/core/framework/op_kernel.cc:1622] OP_REQUIRES failed at iterator_ops.cc:929 : Unknown: {{function_node _inference_Dataset_map_24}} SystemError: returned NULL without setting an error
Traceback (most recent call last):

File "/home/jake/venv/lib/python3.7/site-packages/tensorflow_core/python/ops/script_ops.py", line 219, in call
return func(device, token, args)

File "/home/jake/venv/lib/python3.7/site-packages/tensorflow_core/python/ops/script_ops.py", line 113, in call
ret = self._func(*args)

File "/home/jake/Gits/ssd_tensorflow/train.py", line 21, in func
image = cv2.imread(images[0])

SystemError: returned NULL without setting an error

 [[{{node EagerPyFunc}}]]

Traceback (most recent call last):
File "/home/jake/Gits/ssd_tensorflow/train.py", line 49, in
main()
File "/home/jake/Gits/ssd_tensorflow/train.py", line 47, in main
train()
File "/home/jake/Gits/ssd_tensorflow/train.py", line 42, in train
for image,box in dataset:
File "/home/jake/venv/lib/python3.7/site-packages/tensorflow_core/python/data/ops/iterator_ops.py", line 622, in next
return self.next()
File "/home/jake/venv/lib/python3.7/site-packages/tensorflow_core/python/data/ops/iterator_ops.py", line 666, in next
return self._next_internal()
File "/home/jake/venv/lib/python3.7/site-packages/tensorflow_core/python/data/ops/iterator_ops.py", line 651, in _next_internal
output_shapes=self._flat_output_shapes)
File "/home/jake/venv/lib/python3.7/site-packages/tensorflow_core/python/ops/gen_dataset_ops.py", line 2673, in iterator_get_next_sync
_six.raise_from(_core._status_to_exception(e.code, message), None)
File "", line 3, in raise_from
tensorflow.python.framework.errors_impl.UnknownError: {{function_node _inference_Dataset_map_24}} SystemError: returned NULL without setting an error
Traceback (most recent call last):

File "/home/jake/venv/lib/python3.7/site-packages/tensorflow_core/python/ops/script_ops.py", line 219, in call
return func(device, token, args)

File "/home/jake/venv/lib/python3.7/site-packages/tensorflow_core/python/ops/script_ops.py", line 113, in call
ret = self._func(*args)

File "/home/jake/Gits/ssd_tensorflow/train.py", line 21, in func
image = cv2.imread(images[0])

SystemError: returned NULL without setting an error

 [[{{node EagerPyFunc}}]] [Op:IteratorGetNextSync]

Process finished with exit code 1

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

1 participant