# \[Error\] Unable to infer channel dimension format

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ferror-unable-to-infer-channel-dimension-format%2F78134%3E%5C
**Category:** Beginners\
**Created:** [March 19, 2024, 4:47pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ferror-unable-to-infer-channel-dimension-format%2F78134 "2024-03-19T16:47:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dqctor](https://avatars.discourse-cdn.com/v4/letter/d/958977/32.png) [@Dqctor](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FDqctor)%5C
**Post date:** [March 19, 2024, 4:47pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ferror-unable-to-infer-channel-dimension-format%2F78134%2F1 "2024-03-19T16:47:19Z")

</div>

I’m trying to fine-tuning the facebook/detr-resnet-50 with an existing dataset from hugging\_face, but i got `Unable to infer channel dimension format`  
This is my code:

```auto
from datasets import load_dataset
from transformers import DetrImageProcessor

dataset = load_dataset("arjunpatel1234/Recipe_Ingredients")
tokenizer = DetrImageProcessor.from_pretrained("facebook/detr-resnet-50")

def tokenize_function(examples):
    print(examples["image"])
    image_features = tokenizer(examples["image"], truncation=True)
    print(image_features)
    return image_features

tokenized_datasets = dataset.map(tokenize_function)

```

I get this error:

```auto
raise ValueError("Unable to infer channel dimension format")
ValueError: Unable to infer channel dimension format

```

---

<div class="post-metadata">

**Author:** ![Sandy1857](https://avatars.discourse-cdn.com/v4/letter/s/ecae2f/32.png) [@Sandy1857](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FSandy1857)%5C
**Post date:** [March 20, 2024, 12:35am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ferror-unable-to-infer-channel-dimension-format%2F78134%2F2 "2024-03-20T00:35:07Z")

</div>

Could you print the shape of image? Make sure you are passing an image and not the path of image in the dataset.
