Skip to content

Commit

Permalink
Update black. Reformat. Update savant-rs to 0.2.19. (#726)
Browse files Browse the repository at this point in the history
  • Loading branch information
denisvmedyantsev committed Apr 9, 2024
1 parent fac7a9c commit bb3567c
Show file tree
Hide file tree
Showing 134 changed files with 154 additions and 19 deletions.
1 change: 1 addition & 0 deletions adapters/ds/sinks/always_on_rtsp/__main__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Entrypoint for Always-On-RTSP sink."""

import signal
import time
from pathlib import Path
Expand Down
1 change: 1 addition & 0 deletions adapters/gst/gst_plugins/python/ffmpeg_src.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""FFmpeg src."""

import inspect
from typing import Dict, NamedTuple, Optional

Expand Down
1 change: 1 addition & 0 deletions adapters/gst/gst_plugins/python/savant_parse_bin.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""SavantParseBin element."""

from typing import Optional

from savant.gstreamer import GObject, Gst # noqa:F401
Expand Down
1 change: 1 addition & 0 deletions adapters/gst/gst_plugins/python/zeromq_sink.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""ZeroMQ sink."""

import inspect
import json
from fractions import Fraction
Expand Down
1 change: 1 addition & 0 deletions gst_plugins/python/savant_rs_add_frames.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""SavantRsAddFrames element."""

import inspect
from typing import Any, NamedTuple, Optional

Expand Down
1 change: 1 addition & 0 deletions gst_plugins/python/savant_rs_video_decode_bin.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""SavantRsVideoDecodeBin element."""

import time
from dataclasses import dataclass
from threading import Event, Lock
Expand Down
1 change: 1 addition & 0 deletions gst_plugins/python/savant_rs_video_demux.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""SavantRsVideoDemux element."""

import inspect
import time
from contextlib import contextmanager
Expand Down
1 change: 1 addition & 0 deletions gst_plugins/python/zeromq_properties.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""ZeroMQ properties."""

from savant.gstreamer import GObject


Expand Down
1 change: 1 addition & 0 deletions gst_plugins/python/zeromq_source_bin.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""ZeroMQ src bin."""

from typing import Optional

from savant_rs.pipeline2 import VideoPipeline
Expand Down
1 change: 1 addition & 0 deletions gst_plugins/python/zeromq_src.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""ZeroMQ src."""

import inspect
from typing import Optional, Tuple

Expand Down
2 changes: 1 addition & 1 deletion requirements/dev.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
black~=22.3.0
black~=24.3.0
unify~=0.5
pytest~=7.4.3
isort~=5.12.0
3 changes: 2 additions & 1 deletion samples/age_gender_recognition/age_gender_converter.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Age gender converter module."""

from typing import Any, List, Optional, Tuple

import numpy as np
Expand All @@ -19,7 +20,7 @@ def __call__(
self,
*output_layers: np.ndarray,
model: AttributeModel,
roi: Tuple[float, float, float, float]
roi: Tuple[float, float, float, float],
) -> List[Tuple[str, Any, Optional[float]]]:
"""Converts age gender model output vector to age and gender attribute."""
age = np.sum(np.multiply(output_layers[0], age_range)).item()
Expand Down
1 change: 1 addition & 0 deletions samples/age_gender_recognition/overlay.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Overlay dashboard module."""

from savant_rs.draw_spec import LabelDraw, ObjectDraw

from savant.deepstream.drawfunc import NvDsDrawFunc
Expand Down
1 change: 1 addition & 0 deletions samples/age_gender_recognition/smoothed_counter.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Smoothed counter module."""

import queue
from collections import defaultdict
from typing import Any, Dict
Expand Down
1 change: 1 addition & 0 deletions samples/age_gender_recognition/smoothing.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Analytics module."""

from typing import Dict, Tuple

from samples.age_gender_recognition.smoothed_counter import SmoothedCounter
Expand Down
2 changes: 1 addition & 1 deletion samples/animegan/animegan_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def __call__(
self,
*output_layers: np.ndarray,
model: AttributeModel,
roi: Tuple[float, float, float, float]
roi: Tuple[float, float, float, float],
) -> List[Tuple[str, Any, Optional[float]]]:

img = output_layers[0]
Expand Down
1 change: 1 addition & 0 deletions samples/face_reid/src/index_builder_client.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Index builder module."""

import argparse
import os
import pathlib
Expand Down
1 change: 1 addition & 0 deletions samples/face_reid/src/recognition.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Recognition module."""

import os

import hnswlib
Expand Down
1 change: 1 addition & 0 deletions samples/fisheye_line_crossing/converter.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""YOLOv7 OBB detector output to bbox converter."""

from typing import Tuple

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions samples/fisheye_line_crossing/similari_tracker.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Similari SORT tracker module."""

import math

from savant_rs.primitives.geometry import RBBox
Expand Down
1 change: 1 addition & 0 deletions samples/fisheye_line_crossing/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Line crossing trackers."""

import colorsys
import math
import random
Expand Down
1 change: 1 addition & 0 deletions samples/intersection_traffic_meter/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Line crossing trackers."""

import colorsys
import math
import random
Expand Down
1 change: 1 addition & 0 deletions samples/keypoint_detection/converter.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""YOLOv8Pose postprocessing (converter)."""

from typing import Any, Tuple

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions samples/license_plate_recognition/lprnet_converter.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""LPRNet model output converter."""

from pathlib import Path
from typing import Any, List, Optional, Tuple

Expand Down
1 change: 1 addition & 0 deletions samples/license_plate_recognition/overlay.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Draw func adds license plate"""

from savant_rs.draw_spec import LabelDraw, ObjectDraw

from savant.deepstream.drawfunc import NvDsDrawFunc
Expand Down
1 change: 1 addition & 0 deletions samples/nvidia_car_classification/overlay.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Draw func adds car classification models outputs: car color, car make, car type."""

from savant_rs.draw_spec import LabelDraw, ObjectDraw

from savant.deepstream.drawfunc import NvDsDrawFunc
Expand Down
1 change: 1 addition & 0 deletions samples/opencv_cuda_bg_remover_mog2/bgremover.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Background remover module."""

import cv2

from savant.deepstream.meta.frame import NvDsFrameMeta
Expand Down
1 change: 1 addition & 0 deletions samples/panoptic_driving_perception/pytorch_infer.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Custom PyFunc implementation inference PyTorch model."""

import cv2
import torch
import torchvision
Expand Down
1 change: 1 addition & 0 deletions samples/pass_through_processing/py_func_metrics_example.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Example of how to use metrics in PyFunc."""

from savant.deepstream.meta.frame import NvDsFrameMeta
from savant.deepstream.pyfunc import NvDsPyFuncPlugin
from savant.gstreamer import Gst
Expand Down
1 change: 1 addition & 0 deletions samples/peoplenet_detector/analytics.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Analytics module."""

from collections import defaultdict

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions samples/peoplenet_detector/animation.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Animation module."""

from pathlib import Path

import cv2
Expand Down
1 change: 1 addition & 0 deletions samples/peoplenet_detector/overlay.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Overlay dashboard module."""

from pathlib import Path

import cv2
Expand Down
1 change: 1 addition & 0 deletions samples/peoplenet_detector/person_face_matching.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Person-face matching module."""

from typing import List

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions samples/peoplenet_detector/smoothed_counter.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Smoothed counter module."""

from typing import Any


Expand Down
1 change: 1 addition & 0 deletions samples/peoplenet_detector/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utilies module."""

from typing import Tuple

import cv2
Expand Down
1 change: 1 addition & 0 deletions samples/source_adapter_with_json_metadata/metric.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Analytics module."""

from savant.deepstream.meta.frame import NvDsFrameMeta
from savant.deepstream.pyfunc import NvDsPyFuncPlugin
from savant.gstreamer import Gst
Expand Down
1 change: 1 addition & 0 deletions samples/super_resolution/overlay.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Overlay."""

import cv2
import numpy as np

Expand Down
1 change: 1 addition & 0 deletions samples/template/src/module/custom_pyfunc.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Custom PyFunc implementation."""

from savant.deepstream.meta.frame import NvDsFrameMeta
from savant.deepstream.pyfunc import NvDsPyFuncPlugin
from savant.gstreamer import Gst
Expand Down
1 change: 1 addition & 0 deletions samples/template/src/module/overlay_custom.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Custom DrawFunc implementation."""

from savant.deepstream.drawfunc import NvDsDrawFunc
from savant.deepstream.meta.frame import NvDsFrameMeta
from savant.utils.artist import Artist
Expand Down
1 change: 1 addition & 0 deletions samples/template/src/module/overlay_draw_spec.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Custom DrawFunc implementation."""

from savant_rs.draw_spec import BoundingBoxDraw, ColorDraw, ObjectDraw, PaddingDraw

from savant.deepstream.drawfunc import NvDsDrawFunc
Expand Down
1 change: 1 addition & 0 deletions samples/traffic_meter/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Line crossing trackers."""

import colorsys
import math
import random
Expand Down
1 change: 1 addition & 0 deletions samples/yolov8_seg/module/converter.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""YOLOv8-seg postprocessing (converter)."""

from typing import Any, List, Tuple

import cv2
Expand Down
1 change: 1 addition & 0 deletions samples/yolov8_seg/module/gpu_converter.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""YOLOv8-seg postprocessing (converter)."""

from typing import Any, List, Tuple

import cupy as cp
Expand Down
1 change: 1 addition & 0 deletions samples/yolov8_seg/module/overlay.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Custom DrawFunc implementation."""

import numpy as np

from savant.deepstream.drawfunc import NvDsDrawFunc
Expand Down
2 changes: 1 addition & 1 deletion savant/VERSION
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
SAVANT=0.4.0
SAVANT_RS=0.2.17
SAVANT_RS=0.2.19
DEEPSTREAM=6.4
1 change: 1 addition & 0 deletions savant/base/converter.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Base model output converters."""

from abc import abstractmethod
from enum import Enum
from typing import Any, List, Optional, Tuple, Union
Expand Down
1 change: 1 addition & 0 deletions savant/base/frame_filter.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Ingress / egress filters module."""

from abc import abstractmethod

from savant_rs.primitives import VideoFrame
Expand Down
1 change: 1 addition & 0 deletions savant/base/input_preproc.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Base model input preprocessors."""

from abc import abstractmethod
from typing import Callable, Optional

Expand Down
1 change: 1 addition & 0 deletions savant/base/model.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Base deep learning model configuration templates."""

from dataclasses import dataclass, field
from enum import Enum
from typing import List, Optional, Tuple
Expand Down
1 change: 1 addition & 0 deletions savant/base/pyfunc.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""PyFunc definitions."""

from abc import ABC, abstractmethod
from dataclasses import dataclass
from importlib import util as importlib_util
Expand Down
1 change: 1 addition & 0 deletions savant/base/selector.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Base object selectors."""

from abc import abstractmethod

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions savant/client/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Source/Sink framework for development and QA purposes."""

from .builder.sink import SinkBuilder
from .builder.source import SourceBuilder
from .frame_source import FrameSource
Expand Down
1 change: 1 addition & 0 deletions savant/client/image_source/img_header_parse.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Image header parse utility."""

import re
from os import PathLike
from typing import BinaryIO, Tuple, Union
Expand Down
1 change: 1 addition & 0 deletions savant/client/utils/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
"""Savant Client SDK utilities."""

from .img_resize import resize_preserving_aspect
1 change: 1 addition & 0 deletions savant/client/utils/img_resize.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Image resizing utilities."""

import math
from typing import Tuple

Expand Down
1 change: 1 addition & 0 deletions savant/config/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module configuration."""

from omegaconf import OmegaConf

from .calc_resolver import calc_resolver
Expand Down
1 change: 1 addition & 0 deletions savant/config/calc_resolver.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Calculator resolver for OmegaConf."""

from simpleeval import simple_eval


Expand Down
1 change: 1 addition & 0 deletions savant/config/json_resolver.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""JSON resolver for OmegaConf."""

import json
from typing import Optional, Union

Expand Down
1 change: 1 addition & 0 deletions savant/config/module_config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module configuration."""

import re
from pathlib import Path
from typing import IO, Any, Callable, Iterable, Optional, Tuple, Type, Union
Expand Down
1 change: 1 addition & 0 deletions savant/config/schema.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module and pipeline elements configuration templates."""

import json
from dataclasses import asdict, dataclass, field
from typing import Any, Dict, List, Optional, Union
Expand Down
1 change: 1 addition & 0 deletions savant/converter/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"""Model output postprocessing."""

from .classifier import TensorToLabelConverter
from .vector_attribute import TensorToItemConverter, TensorToVectorConverter
3 changes: 2 additions & 1 deletion savant/converter/classifier.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tensor to label converter."""

from typing import List, Optional, Tuple

import numpy as np
Expand All @@ -21,7 +22,7 @@ def __call__(
self,
*output_layers: np.ndarray,
model: AttributeModel,
roi: Tuple[float, float, float, float]
roi: Tuple[float, float, float, float],
) -> List[Tuple[str, str, Optional[float]]]:
"""Converts attribute (complex) model output layer values to
``(attr_name, label, confidence)`` tuples."""
Expand Down
1 change: 1 addition & 0 deletions savant/converter/rapid.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tensor to bounding box converter."""

from typing import Tuple

import numpy as np
Expand Down

0 comments on commit bb3567c

Please sign in to comment.