From 0d0906dc972a0b5da306b65df3c7a61c4329cfbe Mon Sep 17 00:00:00 2001 From: "Pablo Pizarro R." Date: Sun, 11 Aug 2024 21:13:05 -0400 Subject: [PATCH] Update README & libraries --- MLStructFP/__init__.py | 4 ++-- MLStructFP/db/image/_rect_binary.py | 12 ++++++++---- README.rst | 3 ++- setup.py | 2 +- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/MLStructFP/__init__.py b/MLStructFP/__init__.py index 4f19fba..e669a37 100644 --- a/MLStructFP/__init__.py +++ b/MLStructFP/__init__.py @@ -7,9 +7,9 @@ # Basic information __author__ = 'Pablo Pizarro R.' __description__ = 'Machine learning structural floor plan dataset' -__keywords__ = ['ml', 'ai', 'dataset', 'calc', 'matrix analysis', 'cnn', 'structural analysis', 'structural design'] +__keywords__ = ['ml', 'ai', 'floor-plan', 'architectural', 'dataset', 'cnn'] __email__ = 'pablo@ppizarror.com' -__version__ = '0.5.9' +__version__ = '0.6.0' # URL __url__ = 'https://github.com/MLSTRUCT/MLSTRUCT-FP' diff --git a/MLStructFP/db/image/_rect_binary.py b/MLStructFP/db/image/_rect_binary.py index 76b8926..4c2fcec 100644 --- a/MLStructFP/db/image/_rect_binary.py +++ b/MLStructFP/db/image/_rect_binary.py @@ -36,6 +36,12 @@ class RectBinaryImage(BaseImage): """ Rect binary image. + + This class creates a segmentation mask iterating all rects from a given floor; + obviously, this can be further extended to create other maps, for example, for + wall joints (points), or can be concatenated to create multiple mask tensor for + a given crop (like wall segments + joints). It is up to your imagination and + technical abilities =). I'd say that this is the most important class of all. """ _crop_px: int _initial_backend: str @@ -53,7 +59,7 @@ def __init__( :param path: Image path :param save_images: Save images on path - :param image_size_px: Image size (width/height), bigger images are expensive, double the width, quad the size + :param image_size_px: Image size (width/height), bigger images are expensive; double the width, quad the size """ BaseImage.__init__(self, path, save_images, image_size_px) self._crop_px = int(math.ceil(self._image_size / 32)) # Must be greater or equal than zero @@ -82,7 +88,6 @@ def _get_floor_plot(self, floor: 'Floor', rect: Optional['Rect'], store: bool) - :return: Figure of the floor """ floor_id = str(floor.id) - if floor_id in self._plot.keys(): return self._plot[floor_id] @@ -138,7 +143,7 @@ def _convert_image_color(self, im: 'Image.Image') -> 'Image.Image': :param im: Image :return: Converted image """ - return im.convert('P', palette=Image.ADAPTIVE) + return im.convert('P', palette=Image.Palette.ADAPTIVE) # noinspection PyMethodMayBeStatic def _post_process(self, im: 'Image.Image') -> 'Image.Image': @@ -200,7 +205,6 @@ def make_region(self, xmin: NumberType, xmax: NumberType, ymin: NumberType, ymax assert self._path != '', 'Path cannot be empty' filesave = os.path.join(self._path, figname + '.png') im4.save(make_dirs(filesave), format='PNG') - # print('Rect {0} saved to {1}'.format(rect.id, filesave)) # noinspection PyTypeChecker array = np.array(im4, dtype=TYPE_IMAGE) diff --git a/README.rst b/README.rst index 75c9102..bf91300 100644 --- a/README.rst +++ b/README.rst @@ -38,7 +38,8 @@ scaling. The images can be generated from the real rasterized plan, or by using the polygons stored in the JSON file. Both image and wall polygons are consistent in their placement. -See more information in our `published article `_. +See more information in our `published article `_; also, +check out the `AI segmentation model `_ that tests this dataset. First steps diff --git a/setup.py b/setup.py index 2394393..fcdef9b 100644 --- a/setup.py +++ b/setup.py @@ -19,7 +19,7 @@ 'numpy >= 1.18.5', 'opencv-python <= 4.5.3.56', 'Pillow >= 10.4.0', - 'plotly >= 5.22.0', + 'plotly >= 5.23.0', 'requests >= 2.32.3', 'tabulate >= 0.9.0' ]