Subfolder Error 500 in AutoTrain Image Classification
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 PM2187×1677 256 KB
2024-11-18T01:50:01Z
At first glance, it looks fine. The suspicious thing is thezip? 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…huggingface.coTraining an Object Detection Model with AutoTrainA Blog post by Abhishek Thakur on Hugging Face
2024-11-18T02:10:15Z
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 PM1922×627 29.9 KBWhich is posted here:huggingface.coImage ClassificationWe’re on a journey to advance and democratize artificial intelligence through open source and open science.
2024-11-18T02:23:39Z
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.
2024-11-18T02:45:01Z
Cool, thanks again, John6666!! I will play around with other approaches and I’ll definitely post if I figure it out.
2024-11-18T10:28:27Z
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 inAutoTrainwill get you faster answers or github issues is even betterIssues · huggingface/autotrain-advanced · GitHub
2024-11-18T15:44:29Z
, 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.