Skip To Main Content
Support Knowledge Base

Unable to Load an Image File Using "numpy.array" Function

Content Type: Troubleshooting   |   Article ID: 000088255   |   Last Reviewed: 11/20/2023

Environment

Operating System

Windows® 10, 64-bit*

Description

  • Created an array of specified shape and filled it with random values: random_input_data = np.random.randn(1, 3, 224, 224).astype(np.float16)
  • Replaced the random values with an image file: random_input_data = np.array(r"<image_dir>\image.png").astype(np.float16)
  • Encountered error: ValueError: could not convert string to float: '<image_dir>\image.png'

Resolution

Use cv2.imread("image.png")

Additional information

Related Products

This article applies to 2 products.

Discontinued Products

Intel® Developer Cloud for the Edge