Giter Club home page Giter Club logo

megadetector-gui's Introduction

MegaDetector GUI

AI-assisted Tool for Sorting Camera Trap Images

Based on MegaDetector



Buy Me A Coffee

Introduction

The aim of this project is to provide a simple, easy to use, application that enables field scientists to quickly sort through camera trap images. Camera traps are often set off by moving leaves and consequentlly take lots of empty shots. Weeding out empty images is a mundane task that would typically take several hours of sorting through hundreds of images.

Using machine learning we can reduce the time it takes to sort these images by making use of object detection. This application categorises your images in folders depending on what it thinks it has detected.

Installation

The only currently supported platform is Windows (64-bit).

Go to the Releases page and download the provided installer for the latest available version.

GPU Support

Read the instructions here on how to enable significantly faster processing.

Features

  • automatic detection of animals in a set of photos
  • review process that allows you to correct the results of the automatic detection
  • zoom-and-pan feature on photos during review to help spot animals
  • automatically move the images in labelled folders
  • detailed documentation on how to use the application
  • ability to train and use custom models
  • in-app labelling
  • upload photos to a database of your choice

Contributing

Tech Stack

The app is built using ElectronJS. The UI framework is Svelte, and components are styled using Fomantic-UI

The brains of the app are in Python. I have adapted MegaDetector's code into a slightly more organised API. We use this API to build a basic CLI app that compiles to an executable. The executable is called by the Electron app whenever we need to use the model for inference.

Dev Installation & Running

If you wish to use this project for development purposes follow these steps:

Pre-requsites:

  1. Python 3.x
  2. Node.js

Steps:

  1. Clone this repository
  2. Install the depencies using npm install
  3. Build the Fomantic-UI CSS and JS: npm run semantic-build
  4. Build the backend executable:
    1. cd engine/
    2. Create a virtual environment
    3. Activate the virtual environment
    4. Install requirements: pip install -r requirements.txt
    5. Download the MegaDetector model from here
    6. Place the model file in the engine/models/ folder
    7. Build the .exe: pyinstaller -F cli_wrapper/cli.py

Running the application:

  1. To run the app in dev mode: npm run start
  2. To build the installer: npm run build

megadetector-gui's People

Contributors

petargyurov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

megadetector-gui's Issues

Stripping Keyword meta data

Question
This is great. Im starting to use this for my conservation projects. But, If used on images that already have keywords assigned in the meta data, such as with exifPro or DigiKam, then these are stripped in the sorting process.
Is there a way around this issue?

Cannot correct multiple classifications in a single image

Describe the bug
If the model detects multiple objects in a single image the UI doesn't support correcting them individually. For instance, in an image of a cat, the model may detect cat (correct) and person (incorrect) -- currently the UI doesn't let you remove you incorrect detection.

To Reproduce
Steps to reproduce the behavior:

  1. Run detection (low threshold to increase chance of false positive)
  2. Get an image with a true positive and a false positive
  3. Observe lack of ability to remove false positive result

Expected behavior
Have a button that selectively removes the false positive result whilst preserving the true positive

Screenshots

CSV Output

Feature
CSV output after finishing detection and/or review

Additional Detail
A .csv file that shows the classification, confidence, bounding box data and possibly EXIF data for each image. CSV files are more commonly used by people in the field (compared to the current JSON format).

Hot Reloading is broken

Describe the bug
Reloading the app in dev is broken. Typically in the dev process you use a hot-reloader to automatically reload the app when you make changes. There appears to be something going wrong because on each refresh we just get a blank screen.

To Reproduce
Steps to reproduce the behavior:

  1. Start the app in dev mode
  2. Press Ctrl+R or make a code change and save to prompt the hot-reloader
  3. Observe blank screen

Expected behavior
The app to properly refresh with Ctrl+R and to show new changes if there was a code change

Screenshots
If applicable, add screenshots to help explain your problem.

System Information (please complete the following information):

  • OS: Windows
  • Version 10 (1909)

Additional context
It appears to be an issue caused by the page routing package. Still unsure exactly what it is.

Using other Svelte-specific routers seems like it might be a better choice.
So far this one looks most promising:

Unable to handle remote script errors

Describe the bug
When an error occurs inside a remote script, i.e.: a library, Chromium obfuscates the error message for security reasons.

To Reproduce
Steps to reproduce the behavior:

  1. Go to Review page
  2. Import an empty .json file
  3. Observe error in console and compare to error that is logged

Expected behavior
Such errors to be captured properly.

Screenshots
N/A

System Information (please complete the following information):

  • OS: Windows
  • Version 10 (1909)

Additional context
See:

Smarter data importing

Feature
Handle multiple, nested folders and automatically traverse them to find images

Additional Detail
Typically, camera trap images are taken from multiple SD cards. Each camera names the images with its own name, meaning you end up with non-unique image names across all the SD cards. On top of that the images are typically nested inside multiple folders.

It would be nice for the application to automatically figure out the image location and not be stumped by the duplicate image names.

Interruption toast appears after a successful Detection, when moving to Review stage

Describe the bug
When the detection process successfully finishes, users are presented with a modal and a button to take them to the Review stage. When the button is pressed, the interruption toast appears.

To Reproduce
Steps to reproduce the behavior:

  1. Go to Detection
  2. Start and wait for process to finish
  3. Click on Human Review button
  4. See toast

Expected behavior
Interrutpion toast should not appear in this case

Screenshots
N/A

System Information (please complete the following information):

  • OS: Windows
  • Version: 10

Additional context
N/A

Review process: add animal when "multiple" not detected

Thanks for this GUI! A lot of general users like me thank you for putting Megadetector right in their hands.

I have an issue where 2 animals were next to each other. 1 animal was detected but not the other, so the image was classified as "animal" instead of "multiple". At the moment, when Reviewing, it is not possible to add a detection to a file already classified as "animal".
Could the option "add new animal" be added to the review process?

Review process: allow use of arrow keys + other shortcuts

Feature
Allow use of left/right arrow keys to move through images in the review process. Offer other keyboard shortcuts to add classifications.

Additional Detail
When reviewing lots of images, it's cumbersome to have to click on the "next" button. Allowing the use of left/right arrow keys to move to previous/next image would make for a smoother use. Not sure if it's possible to do.
Additional keyboard shortcuts would help as well: a = animal; e = empty (remove all classifications); m = multiple; p = person; etc.

Backend process isn't killed when app is closed (rare)

Describe the bug
On a couple of occasions I have observed that if you initiate a child process on the backend and close the app, the child process is not killed.

To Reproduce
(Hard to replicate!) Steps to reproduce the behavior:

  1. Go to Detection page
  2. Start the detection process
  3. Wait for image processing to begin
  4. Close app
  5. Observe that data processing finishes eventually

Expected behavior
All backend processes to stop when the app is closed.

Screenshots
N/A
System Information (please complete the following information):

  • OS: Windows
  • Version 10 (1909)

Additional context
Hard to replicate. Willing to close if I cannot replicate enough times.

Video to image utility

Feature
A utility baked into the app that can take a video and split it into individual frames to be processed as images.

Additional Detail
Potentially the application could automatically do the image splitting if it detects that a video has been imported.

Log file could become exceedingly large over time

Describe the bug
There is currently no mechanism to cycle the log file once it reaches a certain size. This means that over time, even through version updates, the log file will grow and grow until it becomes huge. This could lead to various unexpected, unhandled behaviour, and it is also very user-unfriendly.

To Reproduce
N/A

Expected behavior
A mechanism that handles logs better.

Screenshots
N/A

System Information (please complete the following information):
N/A

Additional context
N/A

Review progress reaches 100% before all images have been reviewed

Describe the bug
Sometimes the review progress bar will reach 100% and invoke the completion modal before all images have been reviewed.

To Reproduce
Steps to reproduce the behavior:
Unknown

Expected behavior
Reach 100% only after all images have been reviewed (i.e.: marked as correct or corrected)

Screenshots
N/A

System Information (please complete the following information):

  • OS: Windows
  • Version: 10

Additional context
First thought is that this is probably something to do with using the Prev button and/or the Mark As button and incorrectly updating the progress.

Stopping Detection process invokes the error toast

Describe the bug
When detection is running and users press the Stop button, the error toast shows up.

To Reproduce
Steps to reproduce the behavior:

  1. Go to Detection
  2. Start process
  3. Wait for Stop button to become active
  4. Press Stop button
  5. Observe error toast

Expected behavior
To stop the detection process without errors

Screenshots
N/A

System Information (please complete the following information):

  • OS: Windows
  • Version: 10

Additional context
The error message is null. It is probably something to do with how we handle stderr output from the backend.

ETA timer doesn't update in real-time

Describe the bug
The ETA timer during the detection process is only updated once an image is processed.

To Reproduce
Steps to reproduce the behavior:

  1. Go to the Detect page
  2. Start a detection process
  3. Observe the ETA time only updating when an image is processed

Expected behavior
The timer should count down in real-time after each update

Screenshots
N/A

System Information (please complete the following information):

  • OS: Windows
  • Version 10 (1909)

Additional context
Fixing this would mean that the timer may jump up or down suddenly each time an image is processed. We could add some sort of animation to represent the sudden change.

Any chance we can get MegaDetector v5.0?

Feature
Looking to upgrade the detector to the latest version. v5.0 released in 2022

Additional Detail
Version 4.1 detects a lot of false positives on my images. But some basic testing with 5.0 shows it to be far superior.

Development Methodology and Considerations

Introduction

This document outlines some of the over-arching themes around the development of this application and serves to remind me and any future developers of some important design decisions.

Project Scope

This project's initial aim is to help conservationists by providing an easy to use application that automates the processing of camera trap images using AI.

Stage Description Status
Stage 1 App simplifies the use of MegaDetector and allows users to perform a quick review of the results โœ”๏ธ
Stage 2 Users can use other models trained outside of the app, not just MegaDetector
Stage 3 Users can train pre-trained models and use them in the app
Stage 4 Users can continue to train a custom model each time they import new data

Separate Repositories

At the time of writing, this project is split into two repositories. This decoupling comes with advantages and disadvantages.

Pros ๐Ÿ‘ Cons ๐Ÿ‘Ž
The backend repository can exist as a standalone project Difficult to use GitHub's project management features and management of issues
Confusing build process

At the start of this project I was more inclined to keep the two repos separated. After developing for a couple of months, and taking into consideration the future of the project, I think it would be more beneficial to have a single repo. This is especially important once we enter stage 2.

Inter-process Communication

โ„น๏ธ TODO

Error Handling and Logging

โ„น๏ธ TODO

Improved error handling and logging

Feature
Currently not all errors are handled. We need a robust system that 1) notifies the user of any errors 2) logs detailed error information to a file

Additional Detail
Some errors are already handled, but there isn't much handling of errors coming from the backend process, especially during initiating of the child process.

Review file selection should only accept .json files

Describe the bug
When starting a review, the file import section allows you to load any file, when only JSON is supported.

To Reproduce
Steps to reproduce the behavior:

  1. Go to Review page
  2. Click button to import file
  3. Select a non .json file
  4. Observe error

Expected behavior
The file dialog should be configured to only allow .json files

Screenshots
N/A

System Information (please complete the following information):

  • OS: Windows
  • Version 10 (1909)

Additional context
N/A

Option to not show warning modals again

Feature
The warning modals in the Review process, that pop up when you change the classification result, are too frequent and unnessesary.

Additional Detail
We could either:

  • remove them entirely
  • add a checkbox to hide them from now on

The latter will require that we create a new entry in the config file.

Auto-sort results in incomplete results.csv from results.json. Have to review to get complete updated results.csv

Describe the bug
Firstly thank you for this amazing tool! Processed 8400 images in total this week - across 12 cameras, biggest process batch was 2700 files.

If Auto sort is used, then only the first ~40-70 images will be transferred from the json file to csv file. If review is used then complete updated results.csv is produced.

To Reproduce
Steps to reproduce the behavior:

  1. Process files with Auto-sort
  2. When finished check results.csv - incomplete
  3. load results.json file and review
  4. updated results.csv will be complete

Expected behaviour
complete results.csv file produced from Auto-sort processing.

Screenshots
If applicable, add screenshots to help explain your problem.

System Information (please complete the following information):

  • OS: Windows 10
  • Version 0.0.1

Additional context
Add any other context about the problem here.

Error: EPERM: operation not permitted, open 'debug.log

Describe the bug
Lack of permissions when trying to open the log file. It could also be happening when trying to write to the log file?

To Reproduce
Steps to reproduce the behavior:

  1. Run on a non-admin Windows account (?)
  2. Cause a bug
  3. See error toast appear
  4. Click on Open Log File
  5. Observe another error

Expected behavior
No error

Screenshots
If applicable, add screenshots to help explain your problem.
image

System Information (please complete the following information):

  • OS: Windows
  • Version: 10

Additional context
Runnining the app as Administrator appears to be a workaround.

User Settings

Feature
Introduce a settings panel which users can use to set UI preferrences.

Additional Detail
There is a number of things in the UI which some users may prefer to change the default behaviour of. For instance:

  • toggling the image transition animation
  • default confidence level
  • displaying the image name or the entire path (in the review panel)
  • toggling various warning modals (will just remove modals for now)
  • zoom level (re: zoom & pan feature) (this library is quite finicky and there isn't much styling we can do without breaking things)
  • other things, as the app grows (using electron-store we can easily expand this from now on)

Proposed Mechanism
I think a simpe .json file saved in the root directory will be enough to preserve the state of the settings. The UI can read from the file to display the settings. Each change could overwrite the file, or perhaps a Save button?

Bounding box colour should match label colour

Describe the bug
MegaDetector uses specific colours for each category. Our in-app labels do not match those colours.

To Reproduce
N/A

Expected behavior
For the colours of the bounding box and the in-app label to match.

Screenshots
image

System Information (please complete the following information):

  • OS: Windows
  • Version: 10

Additional context
N/A

Stdout maxBuffer length exceeded

Describe the bug
Child process maxes out the stdout buffer when a large number of images are being processed. From testing, it appears that this happens consistently after processing 11,906 images.

RangeError [ERR_CHILD_PROCESS_STDIO_MAXBUFFER]: stdout maxBuffer length exceeded

To Reproduce
Steps to reproduce the behavior:

  1. Go to Detection
  2. Import +11906 images
  3. Wait until 11906 images have been processed
  4. Observe error

Expected behavior
No error

Screenshots
N/A

System Information (please complete the following information):

  • OS: Windows
  • Version: 10

Additional context
N/A

Review process: option to review only some classifications

Feature
Option to review results for some classifications only

Additional Detail
On starting the review process, use a checklist to select which classifications to review: Animals are usually pretty straightforward and correct so can model can be trusted on that, and users may not want to review the images. I found issues were mostly with Multiples when only one animal was present but shadows made it look like animals; or with images classified as Empty though animals were present (small birds, reptiles). Users may want to review Persons in case they want to look at poaching, etc. Giving the option to choose would save time.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.