From cfc659955d4b60d4cea53f7ceea3526ba2eccb46 Mon Sep 17 00:00:00 2001 From: "Pablo Pizarro R." Date: Thu, 14 Nov 2024 19:05:04 -0300 Subject: [PATCH] Added partition property to rect --- MLStructFP/__init__.py | 2 +- MLStructFP/db/_c_rect.py | 7 ++++++- MLStructFP/db/_db_loader.py | 6 ++++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/MLStructFP/__init__.py b/MLStructFP/__init__.py index 4e43a90..47511a9 100644 --- a/MLStructFP/__init__.py +++ b/MLStructFP/__init__.py @@ -9,7 +9,7 @@ __description__ = 'Machine learning structural floor plan dataset' __keywords__ = ['ml', 'ai', 'floor plan', 'architectural', 'dataset', 'cnn'] __email__ = 'pablo@ppizarror.com' -__version__ = '0.6.9' +__version__ = '0.7.0' # URL __url__ = 'https://github.com/MLSTRUCT/MLSTRUCT-FP' diff --git a/MLStructFP/db/_c_rect.py b/MLStructFP/db/_c_rect.py index e7f0b3f..f57a231 100644 --- a/MLStructFP/db/_c_rect.py +++ b/MLStructFP/db/_c_rect.py @@ -24,6 +24,7 @@ class Rect(BaseComponent): angle: float length: float line: GeomLine2D + partition: bool thickness: float wall: int @@ -39,7 +40,8 @@ def __init__( y: List[float], line_m: NumberType, line_n: NumberType, - line_theta: NumberType + line_theta: NumberType, + partition: bool ) -> None: """ Constructor. @@ -55,6 +57,7 @@ def __init__( :param line_m: Line slope :param line_n: Line intercept :param line_theta: Line angle + :param partition: Rect is partition wall """ BaseComponent.__init__(self, rect_id, x, y, floor) assert isinstance(wall_id, int) and wall_id > 0 @@ -63,12 +66,14 @@ def __init__( assert isinstance(line_m, NumberInstance) assert isinstance(line_n, NumberInstance) assert isinstance(line_theta, NumberInstance) + assert isinstance(partition, bool) self.angle = float(angle) self.length = float(length) self.line = GeomLine2D() self.line.m = float(line_m) self.line.n = float(line_n) self.line.theta = float(line_theta) + self.partition = partition self.thickness = float(thickness) self.wall = wall_id # noinspection PyProtectedMember diff --git a/MLStructFP/db/_db_loader.py b/MLStructFP/db/_db_loader.py index 0a5713b..1bd1b21 100644 --- a/MLStructFP/db/_db_loader.py +++ b/MLStructFP/db/_db_loader.py @@ -104,7 +104,8 @@ def __init__(self, db: str, floor_only: bool = False) -> None: y=rect_data['y'], line_m=rect_data['line'][0], # Slope line_n=rect_data['line'][1], # Intercept - line_theta=rect_data['line'][2] # Theta + line_theta=rect_data['line'][2], # Theta + partition=rect_data['partition'] if 'partition' in rect_data else False # Is partition ) for point_id in data.get('point', {}): point_data: dict = data['point'][point_id] @@ -246,7 +247,8 @@ def hist(self, if f_filter is not None and not f_filter(f): continue fh = f_hist(f) - assert isinstance(fh, list), f'f_hist must return a list of categories to assemble histogram, "{fh}" is not allowed' + assert isinstance(fh, + list), f'f_hist must return a list of categories to assemble histogram, "{fh}" is not allowed' for c in fh: assert isinstance(c, str), f'f_hist must return only strings, "{c}" is not allowed' cat.append(c)