From a211cf6a7bd2edcfb2c3e38ba234c980d8b403e4 Mon Sep 17 00:00:00 2001 From: Denis Stalz-John Date: Mon, 27 Nov 2023 14:29:45 +0100 Subject: [PATCH] fix: comments were fixed --- niceml/data/netdataloggers/netdatalogger.py | 2 +- .../tensorflow/metrics/objdetmetrics.py | 12 +++-- niceml/dlframeworks/tensorflow/models/mlp.py | 4 +- .../objdetpredictionhandler.py | 4 +- poetry.lock | 46 +++++++++---------- pyproject.toml | 4 +- 6 files changed, 39 insertions(+), 33 deletions(-) diff --git a/niceml/data/netdataloggers/netdatalogger.py b/niceml/data/netdataloggers/netdatalogger.py index 34627c2f..fec8270f 100644 --- a/niceml/data/netdataloggers/netdatalogger.py +++ b/niceml/data/netdataloggers/netdatalogger.py @@ -17,7 +17,7 @@ class NetDataLogger(ABC): """Abstract implementation of an NetDataLogger""" def __init__(self): - """Constructor""" + """Initializes the NetDataLogger with default values""" self.data_description = None self.exp_context = None self.set_name = None diff --git a/niceml/dlframeworks/tensorflow/metrics/objdetmetrics.py b/niceml/dlframeworks/tensorflow/metrics/objdetmetrics.py index 6a014128..bb393075 100644 --- a/niceml/dlframeworks/tensorflow/metrics/objdetmetrics.py +++ b/niceml/dlframeworks/tensorflow/metrics/objdetmetrics.py @@ -13,11 +13,11 @@ class AvgPosPredObjDet: # pylint: disable=too-few-public-methods """Positive Classification Values for object detection""" def __init__(self, name: str = "avg_pos_pred"): - """Constructor""" + """Initializes the AvgPosPredObjDet with the given name""" self.__name__ = name def __call__(self, y_true, y_pred): - """Call method for metric""" + """Call method is used as a default interface for the metric""" y_pred = tf.cast(y_pred, dtype=tf.float32) cls_predictions = y_pred[:, :, 4:] @@ -36,11 +36,11 @@ class AvgNegPredObjDet: # pylint: disable=too-few-public-methods """Negative Classification Values for object detection""" def __init__(self, name: str = "avg_neg_pred"): - """Constructor""" + """Initializes the AvgNegPredObjDet with the given name""" self.__name__ = name def __call__(self, y_true, y_pred): - """Call method for metric""" + """Call method is used as a default interface for the metric""" y_pred = tf.cast(y_pred, dtype=tf.float32) cls_predictions = y_pred[:, :, 4:] @@ -69,9 +69,11 @@ class AvgPosTargetCountObjDet: # pylint: disable=too-few-public-methods """Average positive target count for one image in object detection""" def __init__(self, name: str = "avg_pos_target_count"): + """Initializes the AvgPosTargetCountObjDet""" self.__name__ = name def __call__(self, y_true, y_pred): + """Call method is used as a default interface for the metric""" positive_mask = tf.cast( tf.equal(y_true[:, :, 4], POSITIVE_MASK_VALUE), dtype=tf.float32 ) @@ -84,9 +86,11 @@ class AvgNegTargetCountObjDet: # pylint: disable=too-few-public-methods """Average negative target count for one image in object detection""" def __init__(self, name: str = "avg_neg_target_count"): + """Initializes the AvgNegTargetCountObjDet""" self.__name__ = name def __call__(self, y_true, y_pred): + """Call method is used as a default interface for the metric""" negative_mask = tf.cast( tf.equal(y_true[:, :, 4], NEGATIVE_MASK_VALUE), dtype=tf.float32 ) diff --git a/niceml/dlframeworks/tensorflow/models/mlp.py b/niceml/dlframeworks/tensorflow/models/mlp.py index a16f8972..b6ab8f4f 100644 --- a/niceml/dlframeworks/tensorflow/models/mlp.py +++ b/niceml/dlframeworks/tensorflow/models/mlp.py @@ -24,14 +24,14 @@ def __init__( final_activation: str = "linear", do_summary: bool = True, ): - """Constructor""" + """Initializes the OwnMLP model factory""" self.hidden_layers = hidden_layers self.activation = activation self.do_summary = do_summary self.final_activation = final_activation def create_model(self, data_description: DataDescription) -> Any: - """Creates the model""" + """Creates the mlp model""" input_dd: InputVectorDataDescription = check_instance( data_description, InputVectorDataDescription ) diff --git a/niceml/mlcomponents/predictionhandlers/objdetpredictionhandler.py b/niceml/mlcomponents/predictionhandlers/objdetpredictionhandler.py index e1c46c16..e6ddb544 100644 --- a/niceml/mlcomponents/predictionhandlers/objdetpredictionhandler.py +++ b/niceml/mlcomponents/predictionhandlers/objdetpredictionhandler.py @@ -29,7 +29,7 @@ class ObjDetPredictionHandler(PredictionHandler): """Prediction handler for object detection predictions (BoundingBox, class prediction)""" - def __init__( # pylint: disable=too-many-arguments + def __init__( # noqa: PLR0913 self, prediction_filter: PredictionFilter, prediction_prefix: str = "pred", @@ -37,6 +37,7 @@ def __init__( # pylint: disable=too-many-arguments detection_idx_col: str = DETECTION_INDEX_COLUMN_NAME, apply_sigmoid: bool = True, ): + """Initializes the ObjDetPredictionHandler""" super().__init__() self.prediction_filter = prediction_filter self.prediction_prefix = prediction_prefix @@ -52,6 +53,7 @@ def __init__( # pylint: disable=too-many-arguments self.anchor_array = None def initialize(self): + """Initializes the prediction handler""" self.anchors: List[BoundingBox] = self.anchor_generator.generate_anchors( data_description=self.data_description ) diff --git a/poetry.lock b/poetry.lock index 6672cb08..529da190 100644 --- a/poetry.lock +++ b/poetry.lock @@ -60,7 +60,7 @@ tz = ["python-dateutil"] name = "altair" version = "4.2.2" description = "Altair: A declarative statistical visualization library for Python." -optional = false +optional = true python-versions = ">=3.7" files = [ {file = "altair-4.2.2-py3-none-any.whl", hash = "sha256:8b45ebeaf8557f2d760c5c77b79f02ae12aee7c46c27c06014febab6f849bc87"}, @@ -185,7 +185,7 @@ files = [ name = "backports-zoneinfo" version = "0.2.1" description = "Backport of the standard library zoneinfo module" -optional = false +optional = true python-versions = ">=3.6" files = [ {file = "backports.zoneinfo-0.2.1-cp36-cp36m-macosx_10_14_x86_64.whl", hash = "sha256:da6013fd84a690242c310d77ddb8441a559e9cb3d3d59ebac9aca1a57b2e18bc"}, @@ -306,7 +306,7 @@ files = [ name = "cachetools" version = "5.3.1" description = "Extensible memoizing collections and decorators" -optional = false +optional = true python-versions = ">=3.7" files = [ {file = "cachetools-5.3.1-py3-none-any.whl", hash = "sha256:95ef631eeaea14ba2e36f06437f36463aac3a096799e876ee55e5cdccb102590"}, @@ -2170,7 +2170,7 @@ files = [ name = "jsonschema" version = "4.19.0" description = "An implementation of JSON Schema validation for Python" -optional = false +optional = true python-versions = ">=3.8" files = [ {file = "jsonschema-4.19.0-py3-none-any.whl", hash = "sha256:043dc26a3845ff09d20e4420d6012a9c91c9aa8999fa184e7efcfeccb41e32cb"}, @@ -2193,7 +2193,7 @@ format-nongpl = ["fqdn", "idna", "isoduration", "jsonpointer (>1.13)", "rfc3339- name = "jsonschema-specifications" version = "2023.7.1" description = "The JSON Schema meta-schemas and vocabularies, exposed as a Registry" -optional = false +optional = true python-versions = ">=3.8" files = [ {file = "jsonschema_specifications-2023.7.1-py3-none-any.whl", hash = "sha256:05adf340b659828a004220a9613be00fa3f223f2b82002e273dee62fd50524b1"}, @@ -2534,7 +2534,7 @@ testing = ["coverage", "pyyaml"] name = "markdown-it-py" version = "3.0.0" description = "Python port of markdown-it. Markdown parsing, done right!" -optional = false +optional = true python-versions = ">=3.8" files = [ {file = "markdown-it-py-3.0.0.tar.gz", hash = "sha256:e3f60a94fa066dc52ec76661e37c851cb232d92f9886b15cb560aaada2df8feb"}, @@ -2702,7 +2702,7 @@ setuptools_scm = ">=7" name = "mdurl" version = "0.1.2" description = "Markdown URL utilities" -optional = false +optional = true python-versions = ">=3.7" files = [ {file = "mdurl-0.1.2-py3-none-any.whl", hash = "sha256:84008a41e51615a49fc9966191ff91509e3c40b939176e643fd50a5c2196b8f8"}, @@ -3519,7 +3519,7 @@ testing = ["pytest", "pytest-cov"] name = "pkgutil-resolve-name" version = "1.3.10" description = "Resolve a name to an object." -optional = false +optional = true python-versions = ">=3.6" files = [ {file = "pkgutil_resolve_name-1.3.10-py3-none-any.whl", hash = "sha256:ca27cc078d25c5ad71a9de0a7a330146c4e014c2462d9af19c6b828280649c5e"}, @@ -3793,7 +3793,7 @@ email = ["email-validator (>=1.0.3)"] name = "pydeck" version = "0.8.0" description = "Widget for deck.gl maps" -optional = false +optional = true python-versions = ">=3.7" files = [ {file = "pydeck-0.8.0-py2.py3-none-any.whl", hash = "sha256:a8fa7757c6f24bba033af39db3147cb020eef44012ba7e60d954de187f9ed4d5"}, @@ -4041,7 +4041,7 @@ files = [ name = "pytz-deprecation-shim" version = "0.1.0.post0" description = "Shims to make deprecation of pytz easier" -optional = false +optional = true python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,>=2.7" files = [ {file = "pytz_deprecation_shim-0.1.0.post0-py2.py3-none-any.whl", hash = "sha256:8314c9692a636c8eb3bda879b9f119e350e93223ae83e70e80c31675a0fdc1a6"}, @@ -4308,7 +4308,7 @@ pyquery = ">=1.2" name = "referencing" version = "0.30.2" description = "JSON Referencing + Python" -optional = false +optional = true python-versions = ">=3.8" files = [ {file = "referencing-0.30.2-py3-none-any.whl", hash = "sha256:449b6669b6121a9e96a7f9e410b245d471e8d48964c67113ce9afe50c8dd7bdf"}, @@ -4487,7 +4487,7 @@ idna2008 = ["idna"] name = "rich" version = "13.5.2" description = "Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal" -optional = false +optional = true python-versions = ">=3.7.0" files = [ {file = "rich-13.5.2-py3-none-any.whl", hash = "sha256:146a90b3b6b47cac4a73c12866a499e9817426423f57c5a66949c086191a8808"}, @@ -4506,7 +4506,7 @@ jupyter = ["ipywidgets (>=7.5.1,<9)"] name = "rpds-py" version = "0.9.2" description = "Python bindings to Rust's persistent data structures (rpds)" -optional = false +optional = true python-versions = ">=3.8" files = [ {file = "rpds_py-0.9.2-cp310-cp310-macosx_10_7_x86_64.whl", hash = "sha256:ab6919a09c055c9b092798ce18c6c4adf49d24d4d9e43a92b257e3f2548231e7"}, @@ -4988,7 +4988,7 @@ full = ["httpx (>=0.22.0)", "itsdangerous", "jinja2", "python-multipart", "pyyam name = "streamlit" version = "1.28.2" description = "A faster way to build and share data apps" -optional = false +optional = true python-versions = ">=3.8, !=3.9.7" files = [ {file = "streamlit-1.28.2-py2.py3-none-any.whl", hash = "sha256:cc144c4741a1bd850ccd13f1ef18fad170718242dd7930f4ae36e238d08ecd22"}, @@ -5041,7 +5041,7 @@ widechars = ["wcwidth"] name = "tenacity" version = "8.2.3" description = "Retry code until it succeeds" -optional = false +optional = true python-versions = ">=3.7" files = [ {file = "tenacity-8.2.3-py3-none-any.whl", hash = "sha256:ce510e327a630c9e1beaf17d42e6ffacc88185044ad85cf74c0a8887c6a0f88c"}, @@ -5311,7 +5311,7 @@ files = [ name = "toolz" version = "0.12.0" description = "List processing tools and functional utilities" -optional = false +optional = true python-versions = ">=3.5" files = [ {file = "toolz-0.12.0-py3-none-any.whl", hash = "sha256:2059bd4148deb1884bb0eb770a3cde70e7f954cfbbdc2285f1f2de01fd21eb6f"}, @@ -5422,7 +5422,7 @@ typing-extensions = ">=3.7.4" name = "tzdata" version = "2023.3" description = "Provider of IANA time zone data" -optional = false +optional = true python-versions = ">=2" files = [ {file = "tzdata-2023.3-py2.py3-none-any.whl", hash = "sha256:7e65763eef3120314099b6939b5546db7adce1e7d6f2e179e3df563c70511eda"}, @@ -5433,7 +5433,7 @@ files = [ name = "tzlocal" version = "4.3.1" description = "tzinfo object for the local timezone" -optional = false +optional = true python-versions = ">=3.7" files = [ {file = "tzlocal-4.3.1-py3-none-any.whl", hash = "sha256:67d7e7f4ce0a98e9dfde2e02474c60fe846ed032d78b555c554c2e9cba472d84"}, @@ -5556,7 +5556,7 @@ test = ["Cython (>=0.29.32,<0.30.0)", "aiohttp", "flake8 (>=3.9.2,<3.10.0)", "my name = "validators" version = "0.21.2" description = "Python Data Validation for Humans™" -optional = false +optional = true python-versions = ">=3.8" files = [ {file = "validators-0.21.2-py3-none-any.whl", hash = "sha256:6ad95131005a9d4c734a69dd4ef08cf66961e61222e60da25a9b5137cecd6fd4"}, @@ -5800,13 +5800,13 @@ files = [ [[package]] name = "werkzeug" -version = "2.3.7" +version = "3.0.1" description = "The comprehensive WSGI web application library." optional = false python-versions = ">=3.8" files = [ - {file = "werkzeug-2.3.7-py3-none-any.whl", hash = "sha256:effc12dba7f3bd72e605ce49807bbe692bd729c3bb122a3b91747a6ae77df528"}, - {file = "werkzeug-2.3.7.tar.gz", hash = "sha256:2b8c0e447b4b9dbcc85dd97b6eeb4dcbaf6c8b6c3be0bd654e25553e0a2157d8"}, + {file = "werkzeug-3.0.1-py3-none-any.whl", hash = "sha256:90a285dc0e42ad56b34e696398b8122ee4c681833fb35b8334a095d82c56da10"}, + {file = "werkzeug-3.0.1.tar.gz", hash = "sha256:507e811ecea72b18a404947aded4b3390e1db8f826b494d76550ef45bb3b1dcc"}, ] [package.dependencies] @@ -6012,4 +6012,4 @@ visu = ["altair", "streamlit"] [metadata] lock-version = "2.0" python-versions = ">=3.8,<3.9.7 || >3.9.7,<3.11" -content-hash = "ef748252b25904fc1c23149a1b1738db7de52c7114735da7539604fb491e1aef" +content-hash = "243686ea72fbe3a9b35c457b3ecd418dbc8ee47fd98027184ac6bb03874d803a" diff --git a/pyproject.toml b/pyproject.toml index d0eaf3e2..5b41e5b2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -44,7 +44,7 @@ click = "^8.1.3" opencv-python = "^4.7.0.72" cython = "^0.29.34" pyyaml = "^6.0" -pillow = "10.1.0" +pillow = "^10.1.0" fastparquet = "^2023.2.0" hydra-core = "^1.3.2" pympler = "^1.0.1" @@ -68,7 +68,7 @@ protobuf = "^3.0.0" altair = {version = "^4.2.2", optional = true} tensorflow-macos = { version = "~2.12", optional = true} -streamlit = "1.28.2" +streamlit = {version = "^1.28.0", optional = true} tensorflow = {version = "~2.12", optional = true} tensorflow-metal = {version = "~1.0", optional = true} requests = "^2.31.0"