- 21 Dec 2022
- 3 Minutes to read
- Print
- DarkLight
- PDF
Noise Filtering
- Updated on 21 Dec 2022
- 3 Minutes to read
- Print
- DarkLight
- PDF
When you want to ignore model predictions of noisy areas where they are relative small, you can choose noise-filtering post-processing.
Folder Structure
. |
Custom Post-Processing Class
from landinglens.model_iteration.sdk import BaseTransform, DataItem class NoiseFilter(BaseTransform): def __init__(self, pixel_area_threshold=None, percentage_area_threshold=None, **params): if self.pixel_area_threshold and self.percentage_area_threshold: if not self.pixel_area_threshold and not self.percentage_area_threshold: if self.percentage_area_threshold and not (0 <= self.percentage_area_threshold <= 1): if self.pixel_area_threshold and not (self.pixel_area_threshold > 0) or not isinstance(self.pixel_area_threshold, int): def __call__(self, inputs: DataItem) -> DataItem: image - input image. Returns if bboxes is None and labels is None: new_boxes = np.array([]).reshape(-1, 4) for box, score, label in zip(bboxes, scores, labels): if self.pixel_area_threshold and pixels > self.pixel_area_threshold: return DataItem( |
Use Custom Post-Processing in train.yaml
dataset: |