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

**URL:** <https://discuss.huggingface.co/t/error-unable-to-infer-channel-dimension-format/78134>\
**Category:** Beginners\
**Created:** [March 19, 2024, 4:47pm UTC](https://discuss.huggingface.co/t/error-unable-to-infer-channel-dimension-format/78134 "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](https://discuss.huggingface.co/u/Dqctor)\
**Post date:** [March 19, 2024, 4:47pm UTC](https://discuss.huggingface.co/t/error-unable-to-infer-channel-dimension-format/78134/1 "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](https://discuss.huggingface.co/u/Sandy1857)\
**Post date:** [March 20, 2024, 12:35am UTC](https://discuss.huggingface.co/t/error-unable-to-infer-channel-dimension-format/78134/2 "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.
