googlecreativelab / teachablemachine-community

Example code snippets and machine learning code for Teachable Machine
https://g.co/teachablemachine
Apache License 2.0
1.51k stars 678 forks source link

can't upload a folder with images to the teachable machine from drive #191

Open data2450 opened 3 years ago

data2450 commented 3 years ago

Steps to reproduce the behavior:

Go to 'teachable machine/train' Click on 'upload from drive' Scroll down to 'to your file and click upload' if I select a folder it says the folder is empty and loading ample appears forever and if I cntrl+a all images still loads and no images uploaded Relevant Links Link to code to reproduce bug

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context Add any other context about the problem here.

josephrocca commented 3 years ago

I think the problem is that they're expecting you to upload a specially crafted zip file. The buttons say "Open an existing project", meaning one that you've previously saved/exported.

image

If you create a dummy project, then create a cat class and a dog class, then add some images, and then export, you can see that it's just a zip file (though with a .tm file extension instead of .zip, but that doesn't matter) containing images named with this format: cat-!-0.jpg, cat-!-1.jpg, cat-!-2.jpg, dog-!-0.jpg, dog-!-1.jpg, dog-!-2.jpg, etc. and a manifest.json file with content like this:

{"type":"image","version":"2.4.4","appdata":{"publishResults":{},"trainEpochs":50,"trainBatchSize":16,"trainLearningRate":0.001}}

So if you create a folder like that, and then zip it, teachable machine will load it correctly. However, Teachable Machine expects the zip file to directly contain those files, rather than containing a folder that contains those files. So you need to select all the images plus the manifest.json file and compress them into a zip, rather than selecting the containing folder and compressing it.

@HalfdanJ It would be great if there were some helpful error messages that explain where things are going wrong when people try to upload images instead of a project file.