Skip to content

Input shape of image for the classifiers is wrong #32

Description

@federicoromeo

I downloaded the 40 classifiers here, but when i try to run it on an image it gives strange exceptions.

If i run the classifier with:

classifier.run( image , None )

where image is:

image = np.asarray(Image.open('drive/MyDrive/sample_img.jpg').resize((256,256) ) #(256, 256, 3)
image = np.expand_dims(image, axis=0) #(1, 256, 256, 3) = (NWHC)
image = convert_images_from_uint8(images=image,nhwc_to_nchw=True) #(1, 3, 256, 256) = (NCHW)

( NB: convert_images_from_uint8 defined here )

this error comes:
_UnimplementedError (see above for traceback): Generic conv implementation only supports NHWC tensor format for now.
[[node celebahq-classifier-20-goatee/Run/celebahq-classifier-20-goatee/FromRGB_lod0/Conv2D (defined at :159) ]]

But if i comment the function convert_images_from_uint8, thus giving an NWHC image, this arises:

_InvalidArgumentError: input depth must be evenly divisible by filter depth: 256 vs 3
[[{{node celebahq-classifier-20-goatee/Run/celebahq-classifier-20-goatee/FromRGB_lod0/Conv2D}}]]

It seems to me that there are some problems/confusion among the dimensions, since the 256 appearing in the error is not a random number.
How can i fix it?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions