- Here's a part of the project I have done so anyone can build its own Image Classifier in seconds. I have deployed it in HuggingFace Space You can use It and even pay me if you are grateful. Feel free to directly use the class Model on the ModelCreator.py file, and change it if necessary.
Have you got a personal project that needs a tool to automatically classify images? \n This space is intended to give high level tools so everyone can make his own image classification model and use it for any purpose.
- Put some images in a folder classified by subfolders indicating the classes. Like: \n - img_folder/cat/image_of_cat_0.png - img_folder/dog/image_of_dog_4.jpeg \n I recommend around 5 images per class. \n
- Right click in the folder and press "compress..." in ".zip" mode. This will create you a zip file. \n
- Upload the zip file on this space and press "Sumbit Zip File" button. \n
- Congratulations you already have the model. Try it by uploading some images on 'input image' and press "Predict/Test on an image". \n
- Do you want to export the model to use It outside this space? You will need a password. Check the information at the bottom ⬇️
- Consider buying me a coffee subscribing to my patreon coffee tier \n or make a donation trough paypal
- Subscribe to patreon Brunch tier to get the password. patreon
Open the terminal and go to the directory where you placed the requirements.txt file. \n Now with this command you can install the dependencies at once.
pip install -r requirements.txtHas anything gone wrong? Look inside the requirements.txt and install the dependencies one by one.
Place the ModelCreator.py file on the directory you want to code. - some_folder/ModelCreator.py - your_python_script.py
In your_python_script.py, try something like:
from ModelCreator import Model
model_path = 'model.pickle'
m2 = Model().load_model(model_path)
image_path = 'some_image_path/image_1.png'
result = m2(image_path)
print(result)Contact me on huggingface or via e-mail genlain@gmail.com