DetectedFaces
- class tools.manual.detected_faces.DetectedFaces(tk_globals: manual.TkGlobals, alignments_path: str, input_location: str, extractor: manual.Aligner)
Bases:
objectHandles the manipulation of
DetectedFaceobjects stored in the alignments file. Acts as a parent class for the IO operations (saving and loading from an alignments file), the face update operations (when changes are made to alignments in the GUI) and the face filters (when a user changes the filter navigation mode.)- Parameters:
tk_globals (manual.TkGlobals) – The tkinter variables that apply to the whole of the GUI
alignments_path (str) – The full path to the alignments file
input_location (str) – The location of the input folder of frames or video file
extractor (manual.Aligner) – The pipeline for passing faces through the aligner and retrieving results
Attributes Summary
The mask type names stored in the alignments; type as key with the number of faces which possess the mask type as value.
The most up to date full list of detected face objects.
The pipeline for passing faces through the aligner and retrieving results.
Count of faces for each frame.
Handles returning of faces and stats based on the current user set navigation mode filter.
The list of all frame names that appear in the alignments file
The variable indicating whether an edit has occurred meaning a GUI redraw needs to be triggered.
The variable indicating whether a face has been added or removed meaning the
FaceViewergrid redraw needs to be triggered.The variable indicating whether the alignments have been updated since the last save.
Handles the adding, removing and updating of
DetectedFacestored within the alignments file.The frame meta data stored in the alignments file.
Methods Summary
extract()Extract the faces in the current video to a user supplied folder.
is_frame_updated(frame_index)Check whether the given frame index has been updated
Load the faces as
DetectedFaceobjects from the alignments file.revert_to_saved(frame_index)Revert the frame's alignments to their saved version for the given frame index.
save()Save the alignments file with the latest edits.
save_video_meta_data(pts_time, keyframes)Save video meta data to the alignments file.
Attributes Documentation
- available_masks
The mask type names stored in the alignments; type as key with the number of faces which possess the mask type as value.
- current_faces
The most up to date full list of detected face objects.
- extractor
The pipeline for passing faces through the aligner and retrieving results.
- face_count_per_index
Count of faces for each frame. List is in frame index order.
The list needs to be calculated on the fly as the number of faces in a frame can change based on user actions.
- filter
Handles returning of faces and stats based on the current user set navigation mode filter.
- frame_list
The list of all frame names that appear in the alignments file
- tk_edited
The variable indicating whether an edit has occurred meaning a GUI redraw needs to be triggered.
- tk_face_count_changed
The variable indicating whether a face has been added or removed meaning the
FaceViewergrid redraw needs to be triggered.
- tk_unsaved
The variable indicating whether the alignments have been updated since the last save.
- update
Handles the adding, removing and updating of
DetectedFacestored within the alignments file.
- video_meta_data
The frame meta data stored in the alignments file. If data does not exist in the alignments file then
Noneis returned for each Key
Methods Documentation
- extract() None
Extract the faces in the current video to a user supplied folder.
- Return type:
None
- is_frame_updated(frame_index: int) bool
Check whether the given frame index has been updated
- Parameters:
frame_index (int) – The frame index to check
- Return type:
Trueif the given frame index has updated faces within it otherwiseFalse
- load_faces() None
Load the faces as
DetectedFaceobjects from the alignments file.- Return type:
None
- revert_to_saved(frame_index)
Revert the frame’s alignments to their saved version for the given frame index.
- Parameters:
frame_index – The frame that should have their faces reverted to their saved version
- save() None
Save the alignments file with the latest edits.
- Return type:
None
- save_video_meta_data(pts_time: list[int], keyframes: list[int]) None
Save video meta data to the alignments file. This is executed if the video meta data does not already exist in the alignments file, so the video does not need to be scanned on every use of the Manual Tool.
- Parameters:
pts_time (list[int]) – A list of presentation timestamps in frame index order for every frame in the input video
keyframes (list[int]) – A list of frame indices corresponding to the key frames in the input video.
- Return type:
None
- property available_masks: dict[str, int]
The mask type names stored in the alignments; type as key with the number of faces which possess the mask type as value.
- property current_faces: list[list[DetectedFace]]
The most up to date full list of detected face objects.
- extract() None
Extract the faces in the current video to a user supplied folder.
- Return type:
None
- property extractor: manual.Aligner
The pipeline for passing faces through the aligner and retrieving results.
- property face_count_per_index: list[int]
Count of faces for each frame. List is in frame index order.
The list needs to be calculated on the fly as the number of faces in a frame can change based on user actions.
- property filter: Filter
Handles returning of faces and stats based on the current user set navigation mode filter.
- property frame_list: list[str]
The list of all frame names that appear in the alignments file
- is_frame_updated(frame_index: int) bool
Check whether the given frame index has been updated
- Parameters:
frame_index (int) – The frame index to check
- Return type:
Trueif the given frame index has updated faces within it otherwiseFalse
- load_faces() None
Load the faces as
DetectedFaceobjects from the alignments file.- Return type:
None
- revert_to_saved(frame_index)
Revert the frame’s alignments to their saved version for the given frame index.
- Parameters:
frame_index – The frame that should have their faces reverted to their saved version
- save() None
Save the alignments file with the latest edits.
- Return type:
None
- save_video_meta_data(pts_time: list[int], keyframes: list[int]) None
Save video meta data to the alignments file. This is executed if the video meta data does not already exist in the alignments file, so the video does not need to be scanned on every use of the Manual Tool.
- Parameters:
pts_time (list[int]) – A list of presentation timestamps in frame index order for every frame in the input video
keyframes (list[int]) – A list of frame indices corresponding to the key frames in the input video.
- Return type:
None
- property tk_edited: BooleanVar
The variable indicating whether an edit has occurred meaning a GUI redraw needs to be triggered.
- property tk_face_count_changed: BooleanVar
The variable indicating whether a face has been added or removed meaning the
FaceViewergrid redraw needs to be triggered.
- property tk_unsaved: BooleanVar
The variable indicating whether the alignments have been updated since the last save.
- property update: FaceUpdate
Handles the adding, removing and updating of
DetectedFacestored within the alignments file.
- property video_meta_data: dict[Literal['pts_time', 'keyframes'], list[int]] | None
The frame meta data stored in the alignments file. If data does not exist in the alignments file then
Noneis returned for each Key