Skip to content

Commit

Permalink
fix: comments were fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
dstalzjohn committed Nov 27, 2023
1 parent b3be04c commit a211cf6
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 33 deletions.
2 changes: 1 addition & 1 deletion niceml/data/netdataloggers/netdatalogger.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 8 additions & 4 deletions niceml/dlframeworks/tensorflow/metrics/objdetmetrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:]
Expand All @@ -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:]
Expand Down Expand Up @@ -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
)
Expand All @@ -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
)
Expand Down
4 changes: 2 additions & 2 deletions niceml/dlframeworks/tensorflow/models/mlp.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,15 @@
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",
pred_identifier: str = "image_location",
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
Expand All @@ -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
)
Expand Down
46 changes: 23 additions & 23 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down

0 comments on commit a211cf6

Please sign in to comment.