Object Detection Guide
This guide walks you through creating and training an object detection model using AnyLearning. Object detection is a computer vision task that involves both localizing and classifying objects within images. For example, you might want to detect safety equipment like helmets and safety jackets in construction site images to ensure workplace safety compliance.
Step 1: Create a Project
First, create a new project specifically for object detection:
- Click Create project
- Pick Object Detection as the task
- Give your project a meaningful name and description

Step 2: Data Preparation
2.1. Create the Label Set
The label set defines all possible object classes that your model will learn to detect. For our safety equipment detection example, your classes might be safety_helmet and reflective_jacket.
To create your label set:
- Navigate to the "Overview" tab
- Enter each object class name individually in the input field
- Click "+" after each class name
- Ensure class names are descriptive and consistent

2.2. Upload the Datasets
Go to the "Dataset" tab to manage your datasets.
For effective model training, you need to split your data into three sets:
- Training set: The largest portion (typically 70-80%) used to train the model
- Validation set: A smaller portion (typically 10-15%) used to tune hyperparameters and prevent overfitting
- Test set: The remaining portion (typically 10-15%) used to evaluate the final model performance

Upload Process:
- Go to the Dataset tab and choose the Training, Validation or Test set.
- Click Choose images or a .zip, or drop files straight onto the panel. Several images at once is fine, and so is one .zip per split.
- If your images are already annotated, upload the archive as it is: COCO, YOLO, LabelMe and AnyLabeling are all read, and the annotations come in with the images. Ticking Create classes from folder names takes the class list from the archive rather than needing step 2.1 first.
- Wait for the upload to finish. The image and label counts under the panel update as it goes.
Trial Dataset: We prepared a trial dataset for you to get started. You can download it from Hugging Face (opens in a new tab).
Important: Use different images for training, validation, and testing to ensure accurate model evaluation.
2.3. Label the Data
After uploading your datasets, you'll need to label the objects in your images:
- Click the "Label Now" button on the dataset tab
- Use the bounding box tool to draw boxes around objects
- Select the appropriate class label for each box
- Repeat for all images in your dataset

Labeling Tips:
- Draw tight bounding boxes around objects
- Be consistent in your labeling approach
- Label all instances of objects in each image
- Use keyboard shortcuts to speed up labeling
- Take breaks to maintain labeling quality
Pro Tip: For large datasets, consider dividing the labeling work among team members to speed up the process while maintaining consistency.
Step 3: Model Training
Training Configuration:
-
Go to the "Training" tab
-
Click Start training
-
Configure the following hyperparameters:
Model variant: NanoDet-Lightweight, NanoDet-Medium or NanoDet-LargeStarting weights: Default starts from the pretrained weights that ship with AnyLearning; pick an earlier model of yours to continue training from itLearning rate: how far the model moves at each step (0.001 is a sensible start)Batch size: how many images are processed together (8 or 16). It must not exceed the number of images in a split, or the run trains on nothingEpochs: how many times the model sees the whole training setImage size: leave at Model default unless your objects are small, when a larger size helps and costs speedHardware: Automatic uses the GPU when there is one. Choose CPU to leave the GPU freeAugmentation: flips, rotation and colour jitter, generating variations of your images so the model sees more than it was given
Every setting has an ⓘ beside it that explains it in place.
-
Click Start training in the dialog to begin

Monitor Training Progress:
- View all training sessions in the "Training" tab
- Click on any session to see detailed information

Training Metrics and Logs:
- Monitor loss values (classification and localization losses)
- ✅ Check mAP (mean Average Precision) metrics
- View training logs for detailed progress information
- Watch for signs of overfitting (validation metrics getting worse)

Step 4: Test the Trained Model
After training completes, validate your model's performance:
- Go to the Models tab
- Click Try on the model you want to check
- Choose Use a test image to take one from your test split, or Upload an image for a picture the model has never seen
- Analyze the model's predictions

The model will display bounding boxes around detected objects along with class labels and confidence scores:

Step 5: Export the model and use with your code
Use the download button on the model's row and pick Raw Model for the
PyTorch checkpoint, or ONNX Model for the exported graph. The ONNX download
arrives as a zip holding the .onnx file and the config.yml the run was
trained with -- unzip it before using the code below.
The inference code is shown below.

Use the source code from Object Detection Example (opens in a new tab) to run the model.