# Subfolder Error 500 in AutoTrain Image Classification

**URL:** <https://discuss.huggingface.co/t/subfolder-error-500-in-autotrain-image-classification/125378>\
**Category:** Beginners\
**Created:** [November 17, 2024, 7:39pm UTC](https://discuss.huggingface.co/t/subfolder-error-500-in-autotrain-image-classification/125378 "2024-11-17T19:39:42Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![jtseaeye](https://avatars.discourse-cdn.com/v4/letter/j/d2c977/32.png) [@jtseaeye](https://discuss.huggingface.co/u/jtseaeye)\
**Post date:** [November 17, 2024, 7:39pm UTC](https://discuss.huggingface.co/t/subfolder-error-500-in-autotrain-image-classification/125378/1 "2024-11-17T19:39:42Z")

</div>

When I try to run autotrain for a simple two-category image classifier I keep getting this error:

ValueError(f"{self.train\_data} should contain at least 2 subfolders.")

I have zipped folder a named “train” and within it are two subfolders named “positive” and “negative” each with png or jpg files named exactly positive.1.jpg, etc exactly as the docs recommend.

Am I missing something super basic here?

Below is screenshot of the autotrain set-up.

Thank you so much for taking a look!

 ![Screenshot 2024-11-17 at 2.53.22 PM](https://us1.discourse-cdn.com/hellohellohello/original/3X/c/a/ca1b88898a3b4ec49ab33537692516119744ba5b.png)

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](https://discuss.huggingface.co/u/John6666)\
**Post date:** [November 18, 2024, 1:50am UTC](https://discuss.huggingface.co/t/subfolder-error-500-in-autotrain-image-classification/125378/2 "2024-11-18T01:50:01Z")

</div>

At first glance, it looks fine. The suspicious thing is the **zip**? It seems that not only files, but also entire directories are compressed, including the directory structure, or vice versa.  
Also, it seems that it doesn’t work if you set a specific file or directory name, such as “train”. In HF, there are quite a few things that are hard-coded by file name…

> **[Training an Object Detection Model with AutoTrain](https://huggingface.co/blog/abhishek/object-detection-autotrain)**
>
> A Blog post by Abhishek Thakur on Hugging Face

---

<div class="post-metadata">

**Author:** ![jtseaeye](https://avatars.discourse-cdn.com/v4/letter/j/d2c977/32.png) [@jtseaeye](https://discuss.huggingface.co/u/jtseaeye)\
**Post date:** [November 18, 2024, 2:10am UTC](https://discuss.huggingface.co/t/subfolder-error-500-in-autotrain-image-classification/125378/3 "2024-11-18T02:10:15Z")

</div>

Thanks so much, John6666! I see what you’re saying, and I read the blog post, which does have a different approach to file hierarchies than what I saw in the documentation. I’ll try some of these approaches. I was following this format (a single .zip file with two subfolders):

 ![Screenshot 2024-11-17 at 9.07.32 PM](https://us1.discourse-cdn.com/hellohellohello/original/3X/a/3/a36c8da7f5617551c3ca8daf50b7fd5cdb44a8f3.png)

Which is posted here:

> **[Image Classification](https://huggingface.co/docs/autotrain/main/en/image_classification)**
>
> We’re on a journey to advance and democratize artificial intelligence through open source and open science.

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](https://discuss.huggingface.co/u/John6666)\
**Post date:** [November 18, 2024, 2:23am UTC](https://discuss.huggingface.co/t/subfolder-error-500-in-autotrain-image-classification/125378/4 "2024-11-18T02:23:39Z")

</div>

Both of these were written by HF staff… Well, it’s not just HF, but sometimes documents are wrong, or they get out of date, or the library has a bug.😅  
Maybe only the zip extraction is buggy.  
Another possibility is that the handling of jpg files in the HF library is buggy sometimes. If you use png, it’ll be stable. But that’s a rare case.

---

<div class="post-metadata">

**Author:** ![jtseaeye](https://avatars.discourse-cdn.com/v4/letter/j/d2c977/32.png) [@jtseaeye](https://discuss.huggingface.co/u/jtseaeye)\
**Post date:** [November 18, 2024, 2:45am UTC](https://discuss.huggingface.co/t/subfolder-error-500-in-autotrain-image-classification/125378/5 "2024-11-18T02:45:01Z")

</div>

Cool, thanks again, John6666!! I will play around with other approaches and I’ll definitely post if I figure it out.

---

<div class="post-metadata">

**Author:** ![abhishek](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/abhishek/32/32360_2.png) [@abhishek](https://discuss.huggingface.co/u/abhishek)\
**Post date:** [November 18, 2024, 10:28am UTC](https://discuss.huggingface.co/t/subfolder-error-500-in-autotrain-image-classification/125378/6 "2024-11-18T10:28:27Z")

</div>

are you sure you have 2 folders when zip is extracted and not one folder with two subfolders inside? more often, its the first case. when zip is extracted it must produce two folders and NOT one folder with two sub-folders inside.

ps, posting in #🤗AutoTrain will get you faster answers or github issues is even better 🙂[Issues · huggingface/autotrain-advanced · GitHub](https://github.com/huggingface/autotrain-advanced/issues)

---

<div class="post-metadata">

**Author:** ![jtseaeye](https://avatars.discourse-cdn.com/v4/letter/j/d2c977/32.png) [@jtseaeye](https://discuss.huggingface.co/u/jtseaeye)\
**Post date:** [November 18, 2024, 3:44pm UTC](https://discuss.huggingface.co/t/subfolder-error-500-in-autotrain-image-classification/125378/7 "2024-11-18T15:44:29Z")

</div>

🎉, yes, abhishek, that was the “super basic” thing I was missing–thanks so much!  
I had zipped a folder with two subfolders, not created a zip archive from two folders. I’ll post on Autotrain next time—although this was still a very quick reply, much appreciated.
