Species Classification Model Training
Nuclio Functions
Nuclio functions are a serverless computing platform designed to simplify the development, deployment, and scaling of event-driven applications and functions. They allow developers to focus on writing code without worrying about infrastructure management. Nuclio functions are often used in scenarios where rapid response to events is crucial, such as real-time data processing, IoT applications, and microservices architectures.
In the context of camera trap research and Computer Vision Annotation Tool (CVAT), Nuclio functions can be utilized in several ways:
-
Real-time Image Processing: Camera traps capture images or videos when triggered by motion or other events. Nuclio functions can be set up to process these images in real-time as they are captured. For example, they can perform object detection or image classification to identify specific animals or objects of interest.
-
Event Triggered Processing: Nuclio functions can be triggered by specific events such as image captures from camera traps. When a new image is captured, a Nuclio function can be invoked to perform various tasks such as image analysis, data extraction, or integration with other systems.
-
Scalability and Resource Management: Camera trap deployments often involve processing large volumes of image data. Nuclio functions can automatically scale to handle varying workloads, ensuring that resources are efficiently utilized. This scalability is particularly beneficial when dealing with bursts of activity, such as during periods of high animal movement.
-
Integration with CVAT: CVAT is a popular open-source tool for annotating images and videos with bounding boxes, polygons, and other annotations. Nuclio functions can be integrated with CVAT to automate annotation tasks. For example, a Nuclio function can preprocess images captured by camera traps, identify animals or objects within the images, and then automatically generate annotations for these objects in CVAT.
-
Data Aggregation and Analysis: Nuclio functions can be used to aggregate data collected from camera traps and perform analysis tasks such as counting the number of animals observed, tracking their movements over time, or detecting changes in behavior patterns. These insights can provide valuable information for ecological research and wildlife conservation efforts.
Overall, Nuclio functions offer a flexible and scalable platform for deploying event-driven applications in camera trap research and CVAT annotation workflows, enabling efficient processing, analysis, and management of image data.
Species Classifier - Africa, Kenya Region
The following is an example of a Nuclio function that performs species classification on images captured by camera traps in the Africa, Kenya region. The function is triggered by new image captures and uses a pre-trained deep learning model to classify the species present in the images. The results are then stored in a database for further analysis and reporting.
The following files are used to define and implement the Nuclio function:
-
function.yaml
: This file contains the configuration settings for the Nuclio function, including the function name, runtime environment, and trigger settings. -
main.py
: This file contains the Python code that defines the main logic of the Nuclio function. It includes the code for loading the pre-trained species classification model, processing the input images, and storing the results in a database. -
model_handler.py
: This file contains the code for loading and using the pre-trained species classification model. It includes functions for loading the model, preprocessing input images, performing inference, and post-processing the results.
Links to each file can be found below:
function.yaml
https://github.com/Natural-State/NIP-CVAT/blob/develop/serverless/onnx/ns_model/function.yaml
main.yaml
https://github.com/Natural-State/NIP-CVAT/blob/develop/serverless/onnx/ns_model/main.py
model_handler.yaml
https://github.com/Natural-State/NIP-CVAT/blob/develop/serverless/onnx/ns_model/model_handler.py
CI/CD Pipeline
We use Github Actions to automate the deployment of Nuclio functions. The CI/CD pipeline is triggered whenever changes are made to the function definition files. The pipeline includes the following steps:
-
Build: The function definition files are validated and built into a deployable package.
-
Test: The function package is tested to ensure that it functions as expected.
-
Deploy: The function package is deployed to the Nuclio platform.
-
Monitor: The deployed function is monitored to ensure that it is running correctly and handling incoming events.
By automating the deployment process, we can ensure that the Nuclio functions are always up-to-date and ready to process new image captures from camera traps and high-resolution aerial scans. This allows us to focus on developing and improving the image processing and analysis capabilities of the functions, without having to worry about the deployment and management of infrastructure.