Skip to content

Commit f7182f7

Browse files
committed
v1.0.1
1 parent da1813c commit f7182f7

447 files changed

Lines changed: 17210 additions & 29681 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,27 @@
22
__pycache__/
33
*.py[cod]
44
*$py.class
5+
6+
# Temporary data
7+
*.zip
8+
Dataset/Segmentation_Dataset/
9+
Dataset/SD_KF/
10+
11+
# Model files
12+
*.pt
13+
14+
# Training logs
15+
1_Detection_Model/wandb/
16+
17+
# Cache files
18+
**/*.cache
19+
20+
# Checkpoints
21+
.ipynb_checkpoints/
22+
23+
# Model outputs
24+
Detection_Model_Output
25+
Segmentation_Model_Output
26+
1_Detection_Model/runs/
27+
Baseline_2_Model_Output/
28+
Models/

0_Prepare.ipynb

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"id": "cd502a56-2a3b-4e3a-902d-f5cea58e8b00",
6+
"metadata": {},
7+
"source": [
8+
"# DT-SegNet"
9+
]
10+
},
11+
{
12+
"cell_type": "markdown",
13+
"id": "d6490a72-831c-4705-a15b-dd6d5d644750",
14+
"metadata": {},
15+
"source": [
16+
"The root path for this project is `/root/autodl-tmp/`"
17+
]
18+
},
19+
{
20+
"cell_type": "markdown",
21+
"id": "627d8bae-1f9c-4a76-bcd0-98e453c67e0d",
22+
"metadata": {
23+
"tags": []
24+
},
25+
"source": [
26+
"## Prepare for environment"
27+
]
28+
},
29+
{
30+
"cell_type": "markdown",
31+
"id": "b944ca8f-f30a-4482-81ec-6dbeb75bdd7b",
32+
"metadata": {},
33+
"source": [
34+
"### Pull from GitHub"
35+
]
36+
},
37+
{
38+
"cell_type": "code",
39+
"execution_count": null,
40+
"id": "c3f22815-f27c-4c73-b5e3-5d07536cdf38",
41+
"metadata": {},
42+
"outputs": [],
43+
"source": [
44+
"%cd /root/autodl-tmp\n",
45+
"!git clone https://github.com/xiazeyu/DT_SegNet.git\n",
46+
"%cd DT_SegNet"
47+
]
48+
},
49+
{
50+
"cell_type": "markdown",
51+
"id": "0c3fc7d4-e1e3-4b78-8b18-f333452d7c2a",
52+
"metadata": {
53+
"tags": []
54+
},
55+
"source": [
56+
"### Install dependencies"
57+
]
58+
},
59+
{
60+
"cell_type": "code",
61+
"execution_count": null,
62+
"id": "cecc29cc-9b98-4b82-8a75-e4de1bff9b93",
63+
"metadata": {},
64+
"outputs": [],
65+
"source": [
66+
"!nvidia-smi"
67+
]
68+
},
69+
{
70+
"cell_type": "code",
71+
"execution_count": null,
72+
"id": "6a444fdc-6fc9-4441-a709-800e3c8731ba",
73+
"metadata": {},
74+
"outputs": [],
75+
"source": [
76+
"# For detection model\n",
77+
"\n",
78+
"%pip install -r 1_Detection_Model/requirements.txt"
79+
]
80+
},
81+
{
82+
"cell_type": "code",
83+
"execution_count": null,
84+
"id": "ae2f37f9-0e6f-4f96-8c74-004bf4a19687",
85+
"metadata": {},
86+
"outputs": [],
87+
"source": [
88+
"# For segmentation model\n",
89+
"\n",
90+
"# ensure CUDA vision are the same\n",
91+
"%pip install paddlepaddle-gpu==2.4.1.post116 -f https://www.paddlepaddle.org.cn/whl/linux/mkl/avx/stable.html\n",
92+
"%pip install -r 3_Segmentation_Model/requirements.txt"
93+
]
94+
},
95+
{
96+
"cell_type": "markdown",
97+
"id": "fc09f6ae-f548-4591-808c-076b17d9642e",
98+
"metadata": {},
99+
"source": [
100+
"### Verify installation"
101+
]
102+
},
103+
{
104+
"cell_type": "code",
105+
"execution_count": null,
106+
"id": "a246e38c-bd4d-4897-94fb-9d9eb289f4a8",
107+
"metadata": {},
108+
"outputs": [],
109+
"source": [
110+
"%cd 1_Detection_Model\n",
111+
"import torch\n",
112+
"import utils\n",
113+
"display = utils.notebook_init()\n",
114+
"%cd ..\n"
115+
]
116+
},
117+
{
118+
"cell_type": "code",
119+
"execution_count": null,
120+
"id": "670ed144-4df1-43d9-86e2-a4894e786909",
121+
"metadata": {},
122+
"outputs": [],
123+
"source": [
124+
"import paddle\n",
125+
"\n",
126+
"paddle.utils.run_check()\n",
127+
"print(paddle.__version__)\n"
128+
]
129+
}
130+
],
131+
"metadata": {
132+
"kernelspec": {
133+
"display_name": "Python 3 (ipykernel)",
134+
"language": "python",
135+
"name": "python3"
136+
},
137+
"language_info": {
138+
"codemirror_mode": {
139+
"name": "ipython",
140+
"version": 3
141+
},
142+
"file_extension": ".py",
143+
"mimetype": "text/x-python",
144+
"name": "python",
145+
"nbconvert_exporter": "python",
146+
"pygments_lexer": "ipython3",
147+
"version": "3.8.10"
148+
}
149+
},
150+
"nbformat": 4,
151+
"nbformat_minor": 5
152+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
path: ../Dataset/KFold/0
2+
train: train # train images (relative to 'path')
3+
val: val # val images (relative to 'path')
4+
5+
# Classes
6+
nc: 1 # number of classes
7+
names: ['precipitate'] # class names
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
path: ../Dataset/KFold/1
2+
train: train # train images (relative to 'path')
3+
val: val # val images (relative to 'path')
4+
5+
# Classes
6+
nc: 1 # number of classes
7+
names: ['precipitate'] # class names
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
path: ../Dataset/KFold/2
2+
train: train # train images (relative to 'path')
3+
val: val # val images (relative to 'path')
4+
5+
# Classes
6+
nc: 1 # number of classes
7+
names: ['precipitate'] # class names
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
path: ../Dataset/KFold/3
2+
train: train # train images (relative to 'path')
3+
val: val # val images (relative to 'path')
4+
5+
# Classes
6+
nc: 1 # number of classes
7+
names: ['precipitate'] # class names
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
path: ../Dataset/KFold/4
2+
train: train # train images (relative to 'path')
3+
val: val # val images (relative to 'path')
4+
5+
# Classes
6+
nc: 1 # number of classes
7+
names: ['precipitate'] # class names

1_Detection_Model/models/common.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,8 @@ def forward(self, imgs, size=640, augment=False, profile=False):
608608
for i, im in enumerate(imgs):
609609
f = f'image{i}' # filename
610610
if isinstance(im, (str, Path)): # filename or uri
611-
im, f = Image.open(requests.get(im, stream=True).raw if str(im).startswith('http') else im), im
611+
#im, f = Image.open(requests.get(im, stream=True).raw if str(im).startswith('http') else im), im
612+
im, f = Image.open(im), im
612613
im = np.asarray(exif_transpose(im))
613614
elif isinstance(im, Image.Image): # PIL Image
614615
im, f = np.asarray(exif_transpose(im)), getattr(im, 'filename', f) or f

1_Detection_Model/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ requests>=2.23.0
1111
scipy>=1.4.1
1212
torch>=1.7.0
1313
torchvision>=0.8.1
14-
tqdm>=4.64.0
14+
tqdm
1515
protobuf<=3.20.1 # https://github.com/ultralytics/yolov5/issues/8012
1616

1717
# Logging -------------------------------------

0 commit comments

Comments
 (0)