From c917f16bee7258e97a83baeea872f62f169b7779 Mon Sep 17 00:00:00 2001 From: Conner Vieira Date: Sun, 22 Oct 2023 19:43:04 -0400 Subject: [PATCH] Updated TODO --- CONFIGURATION.md | 5 +++++ TODO.md | 4 ++-- main.py | 23 ++++++++++++++++++++++- 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/CONFIGURATION.md b/CONFIGURATION.md index f6298e9..b891e74 100644 --- a/CONFIGURATION.md +++ b/CONFIGURATION.md @@ -122,6 +122,11 @@ Configuration values in this section are settings specific to real-time mode. - `alert` is a decimal number that determines how long Predator will delay before starting the next round when there is an active alert. - `normal` is a decimal number that determines how long Predator will delay before starting the next round under normal circumstances. - `clearing` is a boolean that determines whether or not Predator will clear the output screen between analysis rounds during real-time mode. +- `object_recognition` contains settings related to object recognition in real-time mode. + - `enabled` is a boolean value that enables and disables object recognition in real-time mode. + - This setting does not override the `general>object_recognition>enabled` setting. + - `video_still_path` is an absolute file-path to the image Predator should run object recognition on. + - By default, Phantom stores video stills from the capture device stream to `/dev/shm/phantom-webcam.jpg`, so that is where this setting should point to in most cases. - `gps` contains settings related to GPS-based features. - `enabled` is a boolean determines whether GPS features are enabled or disabled. - `alpr_location_tagging` is a boolean that determines whether or not the current GPS location will be saved to the log file each time a plate is logged. diff --git a/TODO.md b/TODO.md index a12deb1..d725eee 100644 --- a/TODO.md +++ b/TODO.md @@ -70,5 +70,5 @@ These are the features actively planned for Predator and are likely to be added - [X] Improve the efficiency of GPS location requests when many requests are made in quick succession. - [ ] Test that improved GPS location querying behaves as expected. - [X] Kill the ALPR process every time Predator starts to ensure there are no unexpected background threads. -- [ ] Re-implement object recogntion to real-time mode using the new back-end. -- [ ] Re-implement image saving in real-time mode using the new-backend. +- [X] Re-implement object recogntion to real-time mode using the new back-end. + [ ] Verify object recognition functionality. diff --git a/main.py b/main.py index 6640ca9..c6d8135 100644 --- a/main.py +++ b/main.py @@ -783,7 +783,7 @@ - # If enabled, count how many vehicles are in each frame. + # If enabled, count how many objects are in each frame. if (config["general"]["object_recognition"]["enabled"] == True): debug_message("Running object recognition") print("Running object recognition...") @@ -1312,6 +1312,27 @@ + # If enabled, run object recognition on the captured frame. + if (config["general"]["object_recognition"]["enabled"] == True and config["realtime"]["object_recognition"]["enabled"] == True): # Check to make sure real-time object recognition is enabled. + debug_message("Running object recognition") + if (config["realtime"]["interface"]["display"]["output_level"] >= 3): # Only display this status message if the output level indicates to do so. + print("Running object recognition...") + + image = cv2.imread(config["realtime"]["object_recognition"]["enabled"]) # Load the frame. + object_recognition_bounding_box, object_recognition_labels, object_recognition_confidence = cv.detect_common_objects(image) # Anaylze the image. + objects_identified = str(object_recognition_labels) # Convert the list of objects identified into a plain string. + if (objects_identified != "[]"): # Check to see that there were actually identified objects. + if (config["realtime"]["interface"]["display"]["output_level"] >= 2): # Only display this status message if the output level indicates to do so. + print("Objects identified: " + objects_identified) + export_data = str(round(time.time()*10)/10) + "," + objects_identified + "\n" # Add the timestamp to the export data, followed by the object's detected, followed by a line break to prepare for the next entry to be added later. + if (save_real_time_object_recognition == True): # Check to make sure the user has configured Predator to save recognized objects to disk. + add_to_file(root + "/real_time_object_detection.csv", export_data, silence_file_saving) # Add the export data to the end of the file and write it to disk. + + if (config["realtime"]["interface"]["display"]["output_level"] >= 3): # Only display this status message if the output level indicates to do so. + print("Done\n----------") + + + debug_message("Processing ALPR results")