@@ -23,19 +23,19 @@ MLSTRUCT-FP
23
23
:target: https://opensource.org/licenses/MIT
24
24
:alt: License MIT
25
25
26
- Multi -unit floor plan dataset.
26
+ ** M ** \ achine ** L ** \ earning ** STRUCT ** \ ural ** F ** \ loor ** P ** \ lan: A multi -unit floor plan dataset.
27
27
28
28
29
29
Description
30
30
-----------
31
31
32
32
This repo contains the base library to load and parse floor plans from the MLSTRUCT-FP dataset, which
33
33
contains over 954 large-scale floor plan images, alongside annotations for their walls in JSON
34
- format. The database loader just loads in memory the Floor, Walls, and Slab objects, and also
34
+ format. The database loader loads in memory the Floor, Walls, and Slab objects, and also
35
35
offers methods to create custom images from floor plans by applying a crop, a rotation, and a custom
36
36
scaling.
37
37
38
- The images can be generated from the real rasterized plan, or by using the polygons stored in the
38
+ The images can be generated from the real rasterized plan or by using the polygons stored in the
39
39
JSON file. Both image and wall polygons are consistent in their placement.
40
40
41
41
See more information in our `published article <https://doi.org/10.1016/j.autcon.2023.105132 >`_; also,
@@ -45,13 +45,13 @@ check out the `AI segmentation model <https://github.com/MLSTRUCT/MLSTRUCT-FP_be
45
45
First steps
46
46
-----------
47
47
48
- In order to install the library, use the following python-pip commands:
48
+ To install the library, use the following python-pip commands:
49
49
50
50
.. code-block :: bash
51
51
52
52
python -m pip install MLStructFP
53
53
54
- To download the dataset (compressed in .zip), request a public download link by completing a
54
+ To download the dataset (compressed in .zip), request a public download link by completing a
55
55
`simple form <https://forms.gle/HigdGxngnTEvnNC37 >`_.
56
56
57
57
@@ -61,7 +61,7 @@ Dataset details
61
61
The dataset (uncompressed) has the following structure:
62
62
63
63
.. code-block :: bash
64
-
64
+
65
65
dataset/
66
66
0a0...736.png
67
67
0a7...b41.png
@@ -77,7 +77,7 @@ whose labels (wall polygons, slabs) and metadata are stored within fp.json.
77
77
The format of the fp.json file is characterized as follows:
78
78
79
79
.. code-block :: JSON
80
-
80
+
81
81
{
82
82
"rect" : {
83
83
"1000393" : {
@@ -134,7 +134,7 @@ The format of the fp.json file is characterized as follows:
134
134
}
135
135
136
136
Note the dataset comprises a list of "rect" representing the rectangles (wall segments),
137
- "slab" and "floor". Each item has a distinct ID for querying and grouping elements. In the example,
137
+ "slab, " and "floor." Each item has a distinct ID for querying and grouping elements. In the example,
138
138
the rect ID ``1000393 `` is within floor ID ``8970646 ``, with an angle of ``0 `` degrees, a length
139
139
of ``2.6 m ``, and within the wall ID ``5969311 ``. Likewise, the slab ``1002588 `` is within floor
140
140
ID ``5980221 ``, whose its first point (x, y) is ``(-1.153, -22.622) m ``. Finally, the floor ID
@@ -145,15 +145,15 @@ there are ``70873`` rects, ``954`` slabs and ``954`` floors.
145
145
Object API
146
146
----------
147
147
148
- The basic usage of the API is illustrated on the
149
- `jupyter notebook <https://github.com/MLSTRUCT/MLSTRUCT-FP/blob/master/example.ipynb >`_. The most basic
148
+ The primary usage of the API is illustrated on the
149
+ `jupyter notebook <https://github.com/MLSTRUCT/MLSTRUCT-FP/blob/master/example.ipynb >`_. The most fundamental
150
150
object is `DbLoader <https://github.com/MLSTRUCT/MLSTRUCT-FP/blob/master/MLStructFP/db/_db_loader.py >`_,
151
151
which receives the path of the ``fp.json `` file.
152
152
153
153
.. code-block :: python
154
-
154
+
155
155
class DbLoader (db : str )
156
-
156
+
157
157
# Example
158
158
db = DbLoader (' test/data/fp.json' )
159
159
db .tabulate ()
@@ -165,21 +165,21 @@ which receives the path of the ``fp.json`` file.
165
165
DbLoader creates a dict of `Floor <https://github.com/MLSTRUCT/MLSTRUCT-FP/blob/master/MLStructFP/db/_floor.py >`_ object,
166
166
which each contains a dict of `Rect <https://github.com/MLSTRUCT/MLSTRUCT-FP/blob/master/MLStructFP/db/_c_rect.py >`_ and
167
167
`Slab <https://github.com/MLSTRUCT/MLSTRUCT-FP/blob/master/MLStructFP/db/_c_slab.py >`_ objects. Each item is associated
168
- using their respective ids . Floor objects also have many methods to retrieve their elements, plot, and apply
169
- transformations (aka mutations) such as scaling or rotation using ``mutate() `` method:
168
+ with their respective IDs . Floor objects also have many methods to retrieve their elements, plot, and apply
169
+ transformations (aka mutations) such as scaling or rotation using the ``mutate() `` method:
170
170
171
171
.. code-block :: python
172
-
172
+
173
173
class Floor :
174
174
...
175
-
175
+
176
176
def mutate (self , angle : NumberType = 0 , sx : NumberType = 1 , sy : NumberType = 1 ,
177
177
scale_first : bool = True ) -> ' Floor' :
178
178
...
179
-
179
+
180
180
# Example
181
181
plot_floor = db.floor[302 ]
182
- plot_floor.mutate(30 , 1 , 1 ) # 30 degrees, scale 1 on the x-axis, 1 on the y-axis
182
+ plot_floor.mutate(30 , 1 , 1 ) # 30 degrees, scale one on the x-axis, one on the y-axis
183
183
plot_floor.plot_complex()
184
184
185
185
.. image :: docs/example-plot.png
@@ -193,19 +193,19 @@ main responsibilities are creating plan crops for machine learning model trainin
193
193
and downsampling on any image size and scale factor. For both objects, the main methods are:
194
194
195
195
.. code-block :: python
196
-
196
+
197
197
def make_rect (self , rect : ' Rect' , crop_length : NumberType = 5 ) -> Tuple[int , ' np.ndarray' ]:
198
-
198
+
199
199
def make_region (self , xmin : NumberType, xmax : NumberType, ymin : NumberType, ymax : NumberType,
200
200
floor : ' Floor' , rect : Optional[' Rect' ] = None ) -> Tuple[int , ' np.ndarray' ]:
201
201
202
- The first one creates a crop around the provided rect (using its position as the center, adding ``crop_length `` m
202
+ The first creates a crop around the provided rect (using its position as the center, adding ``crop_length `` m
203
203
for each axis). The second one creates a region on any arbitrary ``(xmin, ymin, xmax, ymax) `` region. Consider
204
204
each position in meters.
205
205
206
206
From the provided notebook example, the following image shows two crops generated using a mutated floor plan
207
- with 30 30-degree angle rotation. Crops are `` 256x256 px `` size and display a ``10x10 m `` region, for a selected
208
- rectangle as origin.
207
+ with 30 30-degree angle rotation. Crops are 256x256 px`` in size and display a ``10x10 m `` region for a selected
208
+ rectangle as the origin.
209
209
210
210
.. image :: docs/example-rects.png
211
211
:width: 640
0 commit comments