hoops_ai.storage.loggers.flowlogger
Classes
|
A specialized logger for handling graph annotations, such as faces and edges, with functionalities to log different types of data for visualization purposes. |
- class hoops_ai.storage.loggers.flowlogger.FlowLogger(name, log_file='logfile.log', annotation_file='annotations.log', file_level=20, console_level=30, annotation_level=20, fmt='%(asctime)s : %(levelname)s : %(name)s : %(message)s', datefmt='%Y-%m-%d %H:%M:%S')
Bases:
objectA specialized logger for handling graph annotations, such as faces and edges, with functionalities to log different types of data for visualization purposes. Supports accumulation of annotations with descriptions and exporting them as JSON files.
- Parameters:
- push_edge(description, edge_index, **kwargs)
Logs a generic edge annotation with additional parameters.
Parameters: - description (str): Description label for the annotation. - edge_index (int): The index of the edge to annotate. - **kwargs: Additional keyword arguments for customization.
- push_edge_scalar(description, edge_index, value)
Logs a scalar value annotation for a specific edge.
Parameters: - description (str): Description label for the annotation. - edge_index (int): The index of the edge to annotate. - value (torch.Tensor): The scalar value.
- Parameters:
description (str)
edge_index (int)
value (torch.Tensor)
- Return type:
None
- push_edge_tensor(description, edge_index, tensor)
Logs a tensor annotation for a specific edge.
Parameters: - description (str): Description label for the annotation. - edge_index (int): The index of the edge to annotate. - tensor (torch.Tensor): The tensor data.
- Parameters:
description (str)
edge_index (int)
tensor (torch.Tensor)
- Return type:
None
- push_edge_text(description, edge_index, text)
Logs a text annotation for a specific edge.
Parameters: - description (str): Description label for the annotation. - edge_index (int): The index of the edge to annotate. - text (str): The text to display.
- push_face_histogram(description, face_index, histogram)
Logs a histogram annotation for a specific face.
Parameters: - description (str): Description label for the annotation. - face_index (int): The index of the face (node) to annotate. - histogram (torch.Tensor): Histogram data (e.g., bins and counts).
- Parameters:
description (str)
face_index (int)
histogram (torch.Tensor)
- Return type:
None
- push_face_scalar(description, face_index, value)
Logs a scalar value annotation for a specific face.
Parameters: - description (str): Description label for the annotation. - face_index (int): The index of the face (node) to annotate. - value (torch.Tensor): The scalar value.
- Parameters:
description (str)
face_index (int)
value (torch.Tensor)
- Return type:
None
- push_face_tensor(description, face_index, tensor)
Logs a tensor annotation for a specific face, drawn based on tensor size.
Parameters: - description (str): Description label for the annotation. - face_index (int): The index of the face (node) to annotate. - tensor (torch.Tensor): The tensor data.
- Parameters:
description (str)
face_index (int)
tensor (torch.Tensor)
- Return type:
None
- push_face_text(description, face_index, text)
Logs a text annotation for a specific face.
Parameters: - description (str): Description label for the annotation. - face_index (int): The index of the face (node) to annotate. - text (str): The text to display.
- push_face_vector(description, face_index, vector)
Logs a vector annotation for a specific face, to be drawn as an arrow.
Parameters: - description (str): Description label for the annotation. - face_index (int): The index of the face (node) to annotate. - vector (torch.Tensor): The vector components [x, y, z].
- Parameters:
description (str)
face_index (int)
vector (torch.Tensor)
- Return type:
None
- write()
Exports the accumulated annotations to JSON files. Each file is named with the description and annotation type as prefixes. The JSON files are saved in a subdirectory named ‘annotations_json’ within the same directory as the annotation_file. After exporting, clears the accumulated annotations. Logs the export action.
- Return type:
None