crackenpy 0.1.7__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- crackenpy-0.1.7/LICENSE +28 -0
- crackenpy-0.1.7/PKG-INFO +24 -0
- crackenpy-0.1.7/README.md +142 -0
- crackenpy-0.1.7/setup.cfg +4 -0
- crackenpy-0.1.7/setup.py +41 -0
- crackenpy-0.1.7/src/crackenpy.egg-info/PKG-INFO +24 -0
- crackenpy-0.1.7/src/crackenpy.egg-info/SOURCES.txt +16 -0
- crackenpy-0.1.7/src/crackenpy.egg-info/dependency_links.txt +1 -0
- crackenpy-0.1.7/src/crackenpy.egg-info/requires.txt +12 -0
- crackenpy-0.1.7/src/crackenpy.egg-info/top_level.txt +2 -0
- crackenpy-0.1.7/src/crackest/__init__.py +12 -0
- crackenpy-0.1.7/src/crackest/crack_analyzer.py +630 -0
- crackenpy-0.1.7/src/crackest/crack_pattern_analysis.py +310 -0
- crackenpy-0.1.7/src/crackest/crack_plot.py +194 -0
- crackenpy-0.1.7/src/crackest/cracks.py +294 -0
- crackenpy-0.1.7/src/crackest/model_downloader.py +52 -0
- crackenpy-0.1.7/src/crackest/sub_spec.py +61 -0
- crackenpy-0.1.7/src/crackpy_models/__init__.py +7 -0
crackenpy-0.1.7/LICENSE
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024, Richard Dvořák
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
9
|
+
list of conditions and the following disclaimer.
|
|
10
|
+
|
|
11
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
12
|
+
this list of conditions and the following disclaimer in the documentation
|
|
13
|
+
and/or other materials provided with the distribution.
|
|
14
|
+
|
|
15
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
16
|
+
contributors may be used to endorse or promote products derived from
|
|
17
|
+
this software without specific prior written permission.
|
|
18
|
+
|
|
19
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
20
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
21
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
22
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
23
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
24
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
25
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
26
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
27
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
28
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
crackenpy-0.1.7/PKG-INFO
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: crackenpy
|
|
3
|
+
Version: 0.1.7
|
|
4
|
+
Summary: Library for detection of cracks on test specimens of building materials
|
|
5
|
+
Author: Richard Dvorak, Vlastimil Bilek, Barbara Kucharczikova, Rostislav Krc
|
|
6
|
+
Author-email: richard.dvorak@vutbr.cz
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Requires-Dist: torch>=2.0.0
|
|
9
|
+
Requires-Dist: pandas>=0.23.3
|
|
10
|
+
Requires-Dist: numpy>=1.26.0
|
|
11
|
+
Requires-Dist: matplotlib>=2.2.0
|
|
12
|
+
Requires-Dist: gdown>=5.0.0
|
|
13
|
+
Requires-Dist: sknw>=0.15
|
|
14
|
+
Requires-Dist: tqdm>=4.66.0
|
|
15
|
+
Requires-Dist: scikit-image>=0.21.0
|
|
16
|
+
Requires-Dist: scikit-learn>=0.19.1
|
|
17
|
+
Requires-Dist: wand>=0.6.13
|
|
18
|
+
Requires-Dist: segmentation_models_pytorch>=0.3.3
|
|
19
|
+
Requires-Dist: opencv-python>=4.8.0.76
|
|
20
|
+
Dynamic: author
|
|
21
|
+
Dynamic: author-email
|
|
22
|
+
Dynamic: license-file
|
|
23
|
+
Dynamic: requires-dist
|
|
24
|
+
Dynamic: summary
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+

|
|
2
|
+
Image segmentation of building material surfaces using deep learning (CrackPy)
|
|
3
|
+
=================================================================
|
|
4
|
+
|
|
5
|
+
This package is dedicated to segment cracks, matrix and pores in testing specimens of different building materials. The project was developed under the ressearch project of Grant Agency of Czech Republic No. 22-02098S with title: "Experimental analysis of the shrinkage, creep and cracking mechanism of the materials based on the alkali-activated slag".
|
|
6
|
+
|
|
7
|
+
[](https://doi.org/10.5281/zenodo.13969747)
|
|
8
|
+
|
|
9
|
+
- [Library](https://github.com/Rievil/CrackenPy)
|
|
10
|
+
- [Model](https://huggingface.co/rievil/crackenpy)
|
|
11
|
+
- [Dataset](https://huggingface.co/datasets/rievil/crackenpy_dataset)
|
|
12
|
+
|
|
13
|
+
_Please cite our research paper using the sidebar button when using CrackPy in your research project._
|
|
14
|
+
|
|
15
|
+
The videos documenting the source training images are represented via videos on youtube playlist [Cracks in alkali activated binders](https://youtube.com/playlist?list=PLE4UJv3O5jqNp2Oaqw1vnGiE2zu80q-Xe&si=aJCcwjeDd9LQq3NA).
|
|
16
|
+
|
|
17
|
+
Features
|
|
18
|
+
============================
|
|
19
|
+
Image segmentation of given surface of the test specimen. The photo of the specimen must have minimum resolution of 416 $\times$ 416 pixels.
|
|
20
|
+
The specimens should be placed on close-to-black background. The surface plane of the specimen should be parallel to the objective, to have minimal lens distortion. It is possible to give the main axis dimensions of the speicmens to calculate pixels to mm ratio.
|
|
21
|
+
The CrackPy package is able do generate mask with classes "background", "matrix", "cracks" and "pores". On these classes the CrackPy package introduce couple of metrics, which are the intersection of practises in image processing regarding the evaluation of building materials in the current state of the art. The most basic metrics are:
|
|
22
|
+
|
|
23
|
+
- edge_per_node
|
|
24
|
+
- crack_tot_length
|
|
25
|
+
- average_angle
|
|
26
|
+
- spec_area
|
|
27
|
+
- mat_area
|
|
28
|
+
- crack_ratio
|
|
29
|
+
- crack_length
|
|
30
|
+
- crack_thickness
|
|
31
|
+
- pore_area
|
|
32
|
+
- avg_pore_distance
|
|
33
|
+
- avg_pore_size
|
|
34
|
+
|
|
35
|
+
Tese metrics can be observed all at once, or just some of the metrics can be picked. If the time evolution of one speicmen is adressed the acquring of the metrics can be optimilized, to focus only for the metrics important for the given experiment.
|
|
36
|
+
|
|
37
|
+
The instalation of the package (private package)
|
|
38
|
+
============================
|
|
39
|
+
The package works optimal with NVIDIA GPU together with installed [CUDA](https://developer.nvidia.com/cuda-toolkit) 11.8 or newer. It was also tested on mac OS using MPS backend. The package was tested in Google Colab.
|
|
40
|
+
```
|
|
41
|
+
pip install crackenpy
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
The basic usage of the package
|
|
46
|
+
=============================
|
|
47
|
+
|
|
48
|
+
```Python
|
|
49
|
+
from crackest.cracks import CrackPy
|
|
50
|
+
|
|
51
|
+
#%Model 1 optimized also for pores
|
|
52
|
+
#Model 0 is optimized for fine cracks
|
|
53
|
+
cp=CrackPy(model=1) #
|
|
54
|
+
|
|
55
|
+
#Read a file from examples
|
|
56
|
+
imfile=r'Examples\Img\ID14_940_Image.png'
|
|
57
|
+
cp.get_mask(imfile)
|
|
58
|
+
|
|
59
|
+
#Plot the example
|
|
60
|
+
cp.overlay()
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
After instance initilaization, a pre-trained model is downloaded from HuggingFace repository, the model is stored in package folder for models. If the the NVIDIA GPU and CUDA toolkit is installed it will use cuda for segmentation. It can also use MPS backend on Apple Sillicon M1-M3 chips. The CrackenPy has basically two ways of use. Either on single image, where a specimen on dark background is placed, or on set of images.
|
|
64
|
+
|
|
65
|
+
Single image
|
|
66
|
+
=============================
|
|
67
|
+
The basic usage is t osegment the whole image, and all metrics and masks will represent the whole image. This can be done, if the whole image is either filled with specimen, or if on the image is only the 1 specimen. In both cases all metrics connected to the matrix of binder, cracks and pores are assessed as 1 body / specimen.
|
|
68
|
+
|
|
69
|
+
If there is multiple speicmens on 1 image, then the Cracken should be used.
|
|
70
|
+
|
|
71
|
+
Multiple images
|
|
72
|
+
=============================
|
|
73
|
+
In this scenario on the image multiple specimens are present. In this case it is nessessary which specimen should be assessed. For this a Cracken class is designed. At first it masks the whole image, and then using skimage library segment it into regions. The specimen mask is created out of inverse background mask, therefore it allows to have cracks which are going straight thgough the specimens, and the speicmen is still recognized. Otherwise, the segmentation would returned two different specimens, even tho they would be one body. It will create a set of operations neded to crop and rotate each specimen by its longer axis. The current state of the library takes into account the fact that the photos are taken perpendicular to the base on which the bodies under consideration are placed. Each specimen is given an ID, and allows to retrive the mask and image in stabilized state.
|
|
74
|
+
|
|
75
|
+
The library is build to assess change in time of specimens, which are placed on fixed position in scene and are not moved throught the whole image acquistion period. The original aim is to monitorthe long term changes on multiple specimens. After the first registr of specimens, the segmentation is then always done on croped and stabilized version of image filled with the sample with adjustable frame around it. This saves time and allows to osberve also volumetric changes (expansion, shrinkage).
|
|
76
|
+
|
|
77
|
+
```Python
|
|
78
|
+
from crackest.crack_analyzer import CrackAn
|
|
79
|
+
|
|
80
|
+
ca=CrackAn()
|
|
81
|
+
ca.input(file=r"Examples\Img\256_Image_29-01-2022 02-36-02.png")
|
|
82
|
+
ca.registr()
|
|
83
|
+
ca.preview()
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+

|
|
87
|
+
|
|
88
|
+
Both CrackPy and SubSpecies class inherit plotting methods from class CrackPlot, so it is possible to use same plotting functions for both cases.
|
|
89
|
+
|
|
90
|
+
```Python
|
|
91
|
+
spec=ca.get_spec(specid=0,frame=50)
|
|
92
|
+
spec.overlay()
|
|
93
|
+
```
|
|
94
|
+

|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
The same apply for the CrackAnalyzer, which is generating metrics out of image and its segmented mask. By this a development of metrics can be generated if the folder is given to CrackAn instead of single file. The segmentation in registr method is currently using the same model for recognizing how many specimens is on the image, as well for the segmnetation itself, so for the experiments it is recomended to keep the speicmens still on same spot. Otherwise it would need to segment whole image every time.
|
|
98
|
+
|
|
99
|
+
Future plans
|
|
100
|
+
=============================
|
|
101
|
+
The current library is designed for laboratory enviroment, where every possible of binder can be placed (cement, geopolymers, alkali activated systems) and it should be able to segment cracks, matrix, pores and background. This is intented use, however the crack variety and vast brightness and texture allow to design in general accurate and reliable deep learning aplication for crack
|
|
102
|
+
segmentation in different type of mediums.
|
|
103
|
+
|
|
104
|
+
- Segmentation using photogrammetry (basicly running CrackenPy on UV textures of generated 3D models)
|
|
105
|
+
- Segmentation on videos (using less power demanding models to process bigger volumes of data)
|
|
106
|
+
- Connecting the image with BIM metadata for structure surveing (for infrastructre isnepctions)
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
Acknowledgment
|
|
110
|
+
=============================
|
|
111
|
+
This package was written under the Czech Science Foundation, grant number 22-02098S, project title „Experimental analysis of the shrinkage, creep and cracking mechanism of the materials based on the alkali-activated slag“.
|
|
112
|
+
|
|
113
|
+
Please cite our work
|
|
114
|
+
========================
|
|
115
|
+
```latex
|
|
116
|
+
@misc {richard_dvorak_2024,
|
|
117
|
+
author = { {Richard Dvorak} },
|
|
118
|
+
title = { crackenpy (Revision 04ed02c) },
|
|
119
|
+
year = 2024,
|
|
120
|
+
url = { https://huggingface.co/rievil/crackenpy },
|
|
121
|
+
doi = { 10.57967/hf/3295 },
|
|
122
|
+
publisher = { Hugging Face }
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
@software {Dvorak_CrackenPy_Image_segmentation_2024,
|
|
126
|
+
author = {Dvorak, Richard and Bilek, Vlastimil and Krc, Rostislav and Kucharczykova, Barbara},
|
|
127
|
+
doi = {10.5281/zenodo.13969747},
|
|
128
|
+
month = oct,
|
|
129
|
+
title = {{CrackenPy: Image segmentation tool for semantic segmentation of building material surfaces using deep learning}},
|
|
130
|
+
url = {https://github.com/Rievil/CrackenPy},
|
|
131
|
+
year = {2024}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
@misc {richard_dvorak_2024,
|
|
135
|
+
author = { {Richard Dvorak} },
|
|
136
|
+
title = { crackenpy_dataset (Revision ce5c857) },
|
|
137
|
+
year = 2024,
|
|
138
|
+
url = { https://huggingface.co/datasets/rievil/crackenpy_dataset },
|
|
139
|
+
doi = { 10.57967/hf/3496 },
|
|
140
|
+
publisher = { Hugging Face }
|
|
141
|
+
}
|
|
142
|
+
```
|
crackenpy-0.1.7/setup.py
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""
|
|
3
|
+
Created on Sun Jan 28 17:03:20 2024
|
|
4
|
+
|
|
5
|
+
@author: dvorr
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
from setuptools import Extension, setup, find_packages
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
setup(
|
|
13
|
+
name="crackenpy",
|
|
14
|
+
version="0.1.7",
|
|
15
|
+
description="Library for detection of cracks on test specimens of building materials",
|
|
16
|
+
author="Richard Dvorak, Vlastimil Bilek, Barbara Kucharczikova, Rostislav Krc",
|
|
17
|
+
author_email="richard.dvorak@vutbr.cz",
|
|
18
|
+
packages=find_packages(where="src"),
|
|
19
|
+
install_requires=[
|
|
20
|
+
"torch>=2.0.0",
|
|
21
|
+
"pandas>=0.23.3",
|
|
22
|
+
"numpy>=1.26.0",
|
|
23
|
+
"matplotlib>=2.2.0",
|
|
24
|
+
"gdown>=5.0.0",
|
|
25
|
+
"sknw>=0.15",
|
|
26
|
+
"tqdm>=4.66.0",
|
|
27
|
+
"scikit-image>=0.21.0",
|
|
28
|
+
"scikit-learn>=0.19.1",
|
|
29
|
+
"wand>=0.6.13",
|
|
30
|
+
"segmentation_models_pytorch>=0.3.3",
|
|
31
|
+
"opencv-python>=4.8.0.76",
|
|
32
|
+
],
|
|
33
|
+
package_dir={"": "src"},
|
|
34
|
+
package_data={
|
|
35
|
+
"": ["*.pt"],
|
|
36
|
+
"crackpy_models": [
|
|
37
|
+
"resnext101_32x8d_N387_C5_30102023",
|
|
38
|
+
"resnext101_32x8d_N387_C5_310124",
|
|
39
|
+
],
|
|
40
|
+
},
|
|
41
|
+
)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: crackenpy
|
|
3
|
+
Version: 0.1.7
|
|
4
|
+
Summary: Library for detection of cracks on test specimens of building materials
|
|
5
|
+
Author: Richard Dvorak, Vlastimil Bilek, Barbara Kucharczikova, Rostislav Krc
|
|
6
|
+
Author-email: richard.dvorak@vutbr.cz
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Requires-Dist: torch>=2.0.0
|
|
9
|
+
Requires-Dist: pandas>=0.23.3
|
|
10
|
+
Requires-Dist: numpy>=1.26.0
|
|
11
|
+
Requires-Dist: matplotlib>=2.2.0
|
|
12
|
+
Requires-Dist: gdown>=5.0.0
|
|
13
|
+
Requires-Dist: sknw>=0.15
|
|
14
|
+
Requires-Dist: tqdm>=4.66.0
|
|
15
|
+
Requires-Dist: scikit-image>=0.21.0
|
|
16
|
+
Requires-Dist: scikit-learn>=0.19.1
|
|
17
|
+
Requires-Dist: wand>=0.6.13
|
|
18
|
+
Requires-Dist: segmentation_models_pytorch>=0.3.3
|
|
19
|
+
Requires-Dist: opencv-python>=4.8.0.76
|
|
20
|
+
Dynamic: author
|
|
21
|
+
Dynamic: author-email
|
|
22
|
+
Dynamic: license-file
|
|
23
|
+
Dynamic: requires-dist
|
|
24
|
+
Dynamic: summary
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
setup.py
|
|
4
|
+
src/crackenpy.egg-info/PKG-INFO
|
|
5
|
+
src/crackenpy.egg-info/SOURCES.txt
|
|
6
|
+
src/crackenpy.egg-info/dependency_links.txt
|
|
7
|
+
src/crackenpy.egg-info/requires.txt
|
|
8
|
+
src/crackenpy.egg-info/top_level.txt
|
|
9
|
+
src/crackest/__init__.py
|
|
10
|
+
src/crackest/crack_analyzer.py
|
|
11
|
+
src/crackest/crack_pattern_analysis.py
|
|
12
|
+
src/crackest/crack_plot.py
|
|
13
|
+
src/crackest/cracks.py
|
|
14
|
+
src/crackest/model_downloader.py
|
|
15
|
+
src/crackest/sub_spec.py
|
|
16
|
+
src/crackpy_models/__init__.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|