|
@@ -35,7 +35,7 @@ class MediaFile:
|
|
|
:param reference: use None to remove this file's collection
|
|
|
"""
|
|
|
self.__file.set_collection_by_reference(reference)
|
|
|
- self.__notifications.add(self.__notifications.nm.edit_file, self.__file)
|
|
|
+ self.__notifications.add(self.__notifications.notifications.edit_file, self.__file)
|
|
|
|
|
|
def set_image_label(self, label: Union[int, MediaLabel], frame: int = None):
|
|
|
"""
|
|
@@ -53,7 +53,7 @@ class MediaFile:
|
|
|
data = None
|
|
|
|
|
|
created = self.__file.create_result('pipeline', 'labeled-image', label, data)
|
|
|
- self.__notifications.add(self.__notifications.nm.create_result, created)
|
|
|
+ self.__notifications.add(self.__notifications.notifications.create_result, created)
|
|
|
|
|
|
def add_bounding_box(self, x: float, y: float, w: float, h: float,
|
|
|
label: Union[int, MediaLabel] = None, frame: int = None):
|
|
@@ -80,22 +80,22 @@ class MediaFile:
|
|
|
label = label.identifier
|
|
|
|
|
|
created = self.__file.create_result('pipeline', 'bounding-box', label, result)
|
|
|
- self.__notifications.add(self.__notifications.nm.create_result, created)
|
|
|
+ self.__notifications.add(self.__notifications.notifications.create_result, created)
|
|
|
|
|
|
def remove_predictions(self):
|
|
|
"""
|
|
|
remove and return all predictions added from pipelines
|
|
|
"""
|
|
|
removed = self.__file.remove_results(origin='pipeline')
|
|
|
- for r in removed:
|
|
|
- self.__notifications.add(self.__notifications.nm.remove_result, r)
|
|
|
+ for result in removed:
|
|
|
+ self.__notifications.add(self.__notifications.notifications.remove_result, result)
|
|
|
|
|
|
def __get_results(self, origin: str) -> List[Union[MediaImageLabel, MediaBoundingBox]]:
|
|
|
def map_r(result: Result) -> Union[MediaImageLabel, MediaBoundingBox]:
|
|
|
if result.type == 'labeled-image':
|
|
|
return MediaImageLabel(result)
|
|
|
- else:
|
|
|
- return MediaBoundingBox(result)
|
|
|
+
|
|
|
+ return MediaBoundingBox(result)
|
|
|
|
|
|
return list(map(map_r,
|
|
|
filter(lambda r: r.origin == origin,
|
|
@@ -118,6 +118,11 @@ class MediaFile:
|
|
|
return self.__get_results('pipeline')
|
|
|
|
|
|
def serialize(self) -> dict:
|
|
|
+ """
|
|
|
+ serialize all object properties to a dict
|
|
|
+
|
|
|
+ :return: dict
|
|
|
+ """
|
|
|
return {
|
|
|
'type': self.type,
|
|
|
'size': self.size,
|