Logo Lanfrica

gaynor-lab/gorongosa-classifier

Domain:

environment and energy

Record type:

model
Creator:
gay
Host:
Computer vision model for classifying wildlife species in camera trap images from Gorongosa National Park # Gorongosa National Park ## How New Images Are Processed When you run training.py, the script always scans the image folder. If a cached file exists: (`resnet_training/full_df_filtered.csv`), the script will: - Load the cached filtered dataframe - Compare filenames against the current folder - Detect new images not previously processed - Run MegaDetector only on those new images - Append passing images to the cached CSV - Save the updated CSV - This prevents reprocessing the entire dataset. First run : If the cached CSV does not exist, MegaDetector runs on all images and a CSV is created Subsequent Runs : Only new images are processed so it is much faster πŸ“ Expected Directory Structure ```text gorongosa-classifier/ β”œβ”€β”€ classifier/ β”‚ β”œβ”€β”€ training.py β”‚ β”œβ”€β”€ inference.py β”‚ β”œβ”€β”€ splitting.py β”‚ β”œβ”€β”€ detector.py β”‚ β”œβ”€β”€ dataloader.py β”‚ └── utilities.py β”‚ β”œβ”€β”€ images/ β”‚ └── all_species_images/ β”‚ β”œβ”€β”€ IMG_0001_{site}_{class}.jpg β”‚ β”œβ”€β”€ IMG_0002_{site}_{class}.jpg β”‚ └── ... β”‚ └── resnet_training/ β”œβ”€β”€ full_df_filtered.csv β”œβ”€β”€ last_epoch_predictions_*.json └── last_model_state_resnet18_*.pkl ``` 🧠 MegaDetector Threshold Configured inside training.py: `"megadetector_conf": 0.2` ## Typical values: ```text Threshold Behavior 0.1–0.2 Permissive (keeps more animals, more false positives) 0.3–0.4 Balanced 0.5–0.6 Strict (fewer false positives, may miss small animals) ``` Change this value if: - too many empty images are kept β†’ increase threshold - animals are being missed β†’ decrease threshold πŸš€ Running Training Activate environment: `conda activate speciesnet` Run training: `python training.py` If new images were added, only those will be processed by MegaDetector. πŸ§ͺ Running Inference Single image : `python inference.py --image path/to/image.jpg` Folder : `python inference.py --folder path/to/images` Folder + save CSV : `python inference.py --folder path/to/images --output preds.csv` The script automatically load …

Languages