Is your feature request related to a problem? Please describe.
In the CustomVision-classify-bird-species module there comes a section where there's an explanation of how to upload the training data to custom-vision via a python script. This part to be precise.
After downloading the files, the guide explains that the readers, need to move the folder containing the images (which themselves are in folders each one containing photos of a specific kind of bird) to the same directory as the script. So for example if the folder containing the images is called custom-photos and the script is called app.py, they should be situated next to each other in the same folder as follows:
--customVisionProject/
- app.py
- custom-photos/
In order to fetch the images out of the folder the guide explains that the users need to use python's os module to do a directory change into custom-photos and then run the subsequent lines of code to fetch the images from there, as shown below:
This would then allow them to fetch all subfolders (each one containing images of a specific kind of bird) from the custom-photos directory as follows:
(since we're now inside of the custom-photos directory we can use '.' inside the os.listdir() method.
A consequence of doing it this way is that you can now only run the script once or at least (the chdir portion of it), because it could cause unexpected results when you try to run it, because you may already be in the directory you're trying to chdir into. Which is why the guide puts a warning message right under it, as shown below:
Describe the solution you'd like
As opposed to running the "change directory" method to fetch the folders, I'd suggest that the path to the folder be used to avoid, unwanted reactions when running the script. I.e if we have the following project folder structure:
--customVisionProject/
- app.py
- custom-photos/
(which is the exact same as before). We can fetch the images as follows ( or rather the names of each sub-directory which we need to use as a tag name):
import os
...
path = os.path.abspath('./custom-photos')
tags = [name for name in os.listdir(path) if os.path.isdir(os.path.join(path, name))]
With this there's no need to change directory, and we can run the script as many times as possible, without need for worry.
Describe alternatives you've considered
So I have practically been using my suggested change above as an alternative with the scripts, otherwise i just use the custom vision portal to upload the images.
Additional context
Add any other context or screenshots about the feature request here.
🎓 Add a tag to this issue for your current education role: student, Student Ambassador or educator.
Thank you for submitting this issue! The team will review your issue, tag with the appropriate tags, and comment with any additional questions on information needed. :sparkles:
Is your feature request related to a problem? Please describe.
custom-photos
and the script is calledapp.py
, they should be situated next to each other in the same folder as follows:os
module to do a directory change intocustom-photos
and then run the subsequent lines of code to fetch the images from there, as shown below:custom-photos
directory as follows:(since we're now inside of the
custom-photos
directory we can use'.'
inside theos.listdir()
method.chdir
into. Which is why the guide puts a warning message right under it, as shown below:Describe the solution you'd like
(which is the exact same as before). We can fetch the images as follows ( or rather the names of each sub-directory which we need to use as a tag name):
Describe alternatives you've considered
So I have practically been using my suggested change above as an alternative with the scripts, otherwise i just use the custom vision portal to upload the images.
Additional context
Add any other context or screenshots about the feature request here.
🎓 Add a tag to this issue for your current education role: student, Student Ambassador or educator.
Beta Student Ambassador