CCTV Workflow Documentation
- The following is based on the current understanding on the work flow of CCTV apps.
- All the scripts mentioned here are available in
gqc-utility-notebooksrepository.- It considers the latest workflow of using DB tables instead of CSV files.
- This document has the workflow exemplified using SD1D or May 26 2023 upload for understanding purposes.
Current Workflow
Data (videos and access DBs) is uploaded to Google drive on hydrotrekai@gqc.com, in this case the SD1 CCTV May 25 2023 upload.
The folder structure on which we work on MSI is below:
── git
└── UTILITY_X
└── Data
└── Dataset_X
├── Blurred_Frames
├── Extracted_Frames
├── Logs
├── Received_Data
├── Temp
├── Video_DB
| └── Video_DB.db
| ├── video_groups
| ├── distance_bounding_boxes
| ├── video-groups-1_frames
| ├── video-groups-2_frames
| ├── video_defect_type
| └── PACP_Condition_Code
├── Video_Lists
└── cctv_settings.ymlThe Videos uploaded to Google Drive are downloaded using
rcloneto theRecieved_Datafolder.We start by manually performing Distance Region extraction and Defect type annotations on videos and save the results to a DB called
Video_DB.dbunder Video_DB folder.Before we start populating tables using scripts, the DB has
distance_bounding_boxes,video_defect_type, andPACP_Condition_Code. These are independent for intial steps mentioned in #8.Creation and testing RegEx expressions for testing video types based on utility. This is being done manually and is dependent on the
video_defect_typeMeanwhile, we run the
metadata_DB_extract_inspection_condition_dataon the access DB tables to get a CSV calledall-conditions.csv. This is also independent for intial steps in #8 and is valid for SD1. -The schema of all_conditions.csv is below (reminder that this is specific to SD1 May 26, 2023)| all_conditions |
|--------------------------------- |
| Inspections_InspectionID |
| ConditionID |
| Conditions_InspectionID |
| MediaID |
| Media_Inspections_InspectionID |
| Video_Name |
| Video_Location |
| Distance |
| Counter |
| PACP_Code |
| Continuous |
| Inspections1_InspectionID |
| Conditions1_InspectionID |
| Media_Inspections1_InspectionID |
| Inspections2_InspectionID |
| Conditions2_InspectionID |
| Media_Inspections2_InspectionID |Start the CCTV usage notebooks run on the videos under
Received_Datafolder as follows:Setup YAML parameters with paths and provide the path to YAML file while running following scripts.
Form video groups using
video_list_creatorscript and save the output tovideo_groupstable.Perform Frame extraction based on the video groups.
Using
frame_extractorscript, the resulting frames are saved to Extracted_Frames folder.Corresponding data is saved to respective tables in format
video-group-x_frames. The fields in the video_group_x_frames tables are below:TABLE "video-group-1_frames" (
"video_id" : TEXT,
"frame_id" : TEXT,
"condition_code_list" : TEXT,
"OCR_distance" : FLOAT,
"distance" : FLOAT,
"distance_LF" : TEXT, # should be FLOAT
"OCR_JSON" : JSON,
PRIMARY KEY("frame_id")
);
Run
stitch_and_ocrscript to generate stitched frames and send to the Azure OCR server. The resulting output is populated in the OCR columns in the video_group_x_frames tables.Then we use
blur_framesscript to create blurred frames ZIPs for each video group, saved in theBlurred_Framesfolder.From the blurred frames, we extract distances using
extract_distance_valuesscript, that saves the output toExtracted_Framesas ZIPs. We populate the video_group_x_frames tables with the same.Using the
video_defect_typetable, we then extract condition data by runningextract_condition_codesscript, which populates the condition_code_list in video_group_x_frames tables.
After the above step, we have video_group_x_frames tables with required data to run the final step before training i.e; labelling the frames.
Use
create_SD1_label_imagesscript to generate labels for frames using 2 inputs - distance labels and Conditions data.- It is unclear what the inputs contain specifically.
Once we are done labelling, we can proceed to training.