Megadetector and Trapper

141 views
Skip to first unread message

Richard Atkinson

unread,
Feb 8, 2022, 2:20:02 AM2/8/22
to trapper-project
I'm keen to use some form of AI to filter out 'empty' images through Trapper. Currently I'm looking at Megadetector (https://github.com/microsoft/CameraTraps/) as there is mention of it at https://os-conservation.org/projects/trapper.

Is this going to give me data I can import into Trapper and is there any information on how to use the json file it creates to create bounding boxes and detections in Trapper?

Examples of output from Megadetector:

  {
   "file": "t:\\2021-12-31\\20211231-site4\\SYFR0230.JPG",
   "max_detection_conf": 0.1,
   "detections": [
    {
     "category": "1",
     "conf": 0.1,
     "bbox": [
      0.5822,
      0.2494,
      0.035,
      0.05844
     ]
    }
   ]
  },

Any other information on AI integration would be much appreciated.

Cheers
Richard

bubn...@gmail.com

unread,
Feb 10, 2022, 2:44:17 PM2/10/22
to trapper-project
Hi Richard,

The integration of Trapper with AI is still a very new stuff and unfortunately a user-documentation is not yet available. However, the code is already there and if you are interested in using MD together with Trapper you have a couple of options that you can try:

1. Using MD via its batch processing API


   https://github.com/microsoft/CameraTraps/tree/main/api/batch_processing

   We have recently implemented in Trapper the MD connector responsible for handling requests & responses from this batch processing API:
   
   https://gitlab.com/oscf/trapper-project/-/blob/development/trapper/trapper-project/trapper/apps/media_classification/ai_providers/megadetector.py

   You can configure this connector directly in the admin panel:

   https://localhost/admin/media_classification/aiprovider/

2. Using MD locally and sending the results back to Trapper -> option 1

  You would need to write your own code interacting with Trapper's internal AI-related API, especially with the following two endpoints:

  PUT /media_classification/api/classify/ai/callback/{ai_provider_token}/
  GET /media_classification/api/classify/ai/classification_extra/{ai_provider_token}/{classification_job_id}/{resource_name}/

  See https://localhost/docs/api/

3. Using MD locally and sending the results back to Trapper -> option 2

   You can re-shape the results from MD to strictly follow the Camtrap DP specification (https://tdwg.github.io/camtrap-dp/data/#observations) and then you can import to Trapper a properly formatted CVS table using this view:

   https://localhost/media_classification/classification/import/

   Unfortunately, at the moment you can not import data on bounding boxes; they are supported by Trapper's internal mode but they are not (yet) part of the official Camtrap DP specification (but we are considering adding this functionality as an extra option during import)

4. Using Trapper-AI

Trapper-AI is a closed solution at the moment, that we plan to offer to Trapper users as a paid module (as we need to generate some income to support our Trapper dev team and Foundation). It is currently tested in production conditions, so the final release will come likely end of February. At the moment it is integrated with Megadetector but in general it allows for implementation of other models, e.g. custom trained.

I hope it will be useful.

Best,
Kuba
Reply all
Reply to author
Forward
0 new messages