Conversation
… configinfo object and it attributes
changed all attribute names in class configInfo to be capitalized. Changed refences to CONFIG to object config of the configInfo class. To access class attibutes use config.'ATTRIBUTE_NAME'
…nfiguration information.
…ile. Called parse_args in main and passed return value to configInfo to create config object. Also passed the return value to fetch and alert.
… argurment parser to main. This class now expects a config_path as a string when creating a ConfigInfo object.
… config_path in main to clarify the passing of objects vs. paths
…y pylint and flake8. Unable to resolve 2 import errors.
…dated class ConfigInfo.
…changed detector in ConfigInfo to detector_model.
…fer model, detector model, and class_list using the passed config object.
… Unable to resolve some pylint import errors.
…nged 121 to use enumerate.
…ction and request timeout exceptions.
|
We don't want to include the "logs" folder in this pr, it just contains dataframes that are generated when the program is run, and shouldnt be in this pr. |
|
youll also need to update the fetch_and_alert.yml to reflect the changes made to the config file. you made the changes in your copy of the yaml file, but the example fetch_and_alert.yml needs to be updated and pushed as well. make sure to not include any passwords or anything in the config file that gets pushed to github |
cougarvision_utils/detect_img.py
Outdated
|
|
||
| # add path to camera traps repository instead using | ||
| # cougar traps yaml | ||
| sys.path.append(config.traps_path) |
There was a problem hiding this comment.
we can actually remove this altogether- and from the config file. im realizing it was a legacy library needed before the recent animl update. so feel free to remove this line and remove camera traps repo path from the config as well.
cougarvision_utils/get_images.py
Outdated
| try: | ||
| response = requests.get(call, headers={"X-User-Email": username, | ||
| "X-User-Token": auth_token}, | ||
| timeout=10) |
There was a problem hiding this comment.
increase timeout to 20 seconds, my internet connection took longer than 10 seconds to make the first request so it looked like it was failing but increasing this timeout gave it enough time to make the request
| info = json.loads(response.text) | ||
| return info | ||
|
|
||
| except requests.exceptions.ConnectionError as e: |
There was a problem hiding this comment.
have the attempts write to the log file. so that we can look back later and see failed connection attempts
cougarvision_utils/get_images.py
Outdated
| print(f'Timeout Error {attempt + 1}: {e}') | ||
| time.sleep(15) # wait 15 seconds | ||
|
|
||
| raise Exception("Failed to connect after multiple attempts.") |
There was a problem hiding this comment.
i think we should keep this in for now- but i have an idea to make this better in a way that doesnt kill the program if it fails 5 retries. ill make a new issue so that we can merge this branch and then address that fix after
Dataclass provided more built in fuctions for a cleaner approach to storing values from the config files. It allows for seperation of parsing the config file and for appending additonally field definitions after the class is intialized.
Refactored Fetch and Alert to use a new class get info which gets all the information from the configuration file. Pylint and flake8 errors fixed for get images, detect images, get info, and fetch and alert.