AiNaType is an open-source Python project for automated image classification, primarily focused on identifying wildlife signs such as live animals, dead specimens, scat, and tracks using deep learning models. The repository leverages the Ultralytics YOLO framework and provides both API and Gradio app interfaces for prediction and demonstration.
- YOLO-based Classification: Utilizes YOLO models to classify images into categories like dead, live animal, scat, and tracks.
- API Interface: FastAPI-based endpoint (
/predict) for programmatic image classification, supporting custom model weights and versioning. - Gradio Demo App: User-friendly web app for interactive image uploads and quick predictions.
- Annotation Utilities: Scripts for exporting and processing annotation tasks with Label Studio integration.
- Batch Prediction: SQLite-based tracking of image predictions for bulk processing.
Pre-trained model weights for AiNaType can be downloaded from the Releases page. Download the appropriate weights files and specify their path in your API or batch prediction scripts.
-
Clone the repository:
git clone https://github.com/Alyetama/AiNaType.git cd AiNaType -
Install requirements:
pip install -r requirements.txt
-
(Optional) Set up environment variables for annotation export:
LABEL_STUDIO_URL=<your_label_studio_url> API_KEY=<your_api_key>
Run the demo app for interactive classification:
python gradio-app-demo.pyVisit the displayed URL to upload images and view predictions.
Start the FastAPI server:
python api-ainatype.py -w <path_to_weights> -m <model_version>Send a POST request to /predict with JSON payload containing the image URL and project information.
Process a directory of images and store results in a SQLite database:
python predict.py -d <db_path> -m <model_path> -i <images_dir>Export annotations from Label Studio via shell script:
bash misc/export_annotations.shapi-ainatype.py: FastAPI server implementation.gradio-app-demo.py: Gradio demo web app.predict.py: Batch prediction script with SQLite tracking.misc/get_annotations.py: Python script to fetch and save annotations.
This project is licensed under the MIT License. See LICENSE for details.
Developed by Mohammad Alyetama.