Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Animl update and wild_demo #59

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open

Animl update and wild_demo #59

wants to merge 17 commits into from

Conversation

kgarwoodsdzwa
Copy link
Collaborator

this pull request reflects a few updates which should be in different pull requests, but they are in one. there is now capability to run a visualization of the output in a demo setting by changing a few config values, and allows for the usage of .pt classifier models. there is also logging to a file that now takes place.

kgarwoodsdzwa and others added 15 commits November 16, 2023 14:15
updating wild demo to reflect master
Revert "updating wild demo to reflect master"
The demo branch was created hard and fast and these commits
make the demo portion more modular in the sense that with
merely a few extra lines to the config, you can make fetch_and_alert
run the necessary portions to allow the output to be visualized.
Currently, one must run this version of fetch_and_alert and
simultaneously run display.py with the same config
file as fetch and alert to work. display.py is the main function
and visualize_helper.py contain some functions that get called
in fetch_and_alert to ensure the images are in the proper place
and format for display.py to reach them.
Was called visualize_output now called visualize_helper
The script was not writing the log to a file, only to the terminal
and was logging duplicated lines. It needed to be initialized
before calling the classifier and detector initializers because
when those got called first, they introduced their own logging
handlers that overrode the one I created. Also the force=True
needed to be added so that the log file would actually be created
There's a few "too many variables" and "unable to import" errors
but I'm ignoring those
We trained a new model 'southwest_v3.pt' that performs better
on cougars than the previous model, but the animl-py on pypi
can only handle h5 models. Cougarvision had to be updated to be
compatible with the updates that have been made to animl-py
on github where there exists the capability to use .pt models. It
was mostly function name changes and movement, and the updates
only affected fetch_and_alert.py for loading the classifier model
and detect_img.py.
The example config file was missing some of the parameters
needed by cougarvision wild_demo update. This config file now exposes
the color for the bounding box, sending email alerts, the time between
fetch_and_alert function call, and changed the names of the config
values for dev and consumer emails.
There was an old animl function called parse_results
that prepared the classification output for alert sending
this has been depricated and that old function is no longer
necessary
the example config needed to be updated to reflect changes
wild_demo had animl_update created based off wild_demo, need to be merged before pr to master
Copy link
Collaborator

@tkswanson tkswanson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did you get rid of the admin key? also you included our own camera names

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is fine but we want to avoid species-specific nomenclature going forward, switch to "detections"


from cougarvision_utils.cropping import draw_bounding_box_on_image
from cougarvision_utils.alert import smtp_setup, send_alert
from cougarvision_visualize.visualize_helper import get_last_file_number
from cougarvision_visualize.visualize_helper import create_folder


with open("config/cameratraps.yml", 'r') as stream:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not be part of the module, this should be run once from the main function

@@ -68,11 +70,21 @@ def request_strikeforce(username, auth_token, base, request, parameters):
strikeforce
'''
call = base + request + "?" + parameters
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be a function that is called, it shouldn't just run every time the module is opened

return max_num


def create_folder(folder_path):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this function can be replaced with os.makedirs(exist_ok=True)



# Set interval for checking in
CHECKIN_INTERVAL = CONFIG['checkin_interval']

print("Loading classifier")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All this should be in main()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants