完成实验四
This commit is contained in:
parent
7fbb893223
commit
feca24347a
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,4 +1,4 @@
|
|||||||
dataset/
|
raw/
|
||||||
|
|
||||||
.vscode/
|
.vscode/
|
||||||
|
|
||||||
|
@ -1121,9 +1121,9 @@
|
|||||||
],
|
],
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python [conda env:DeepLearningLab]",
|
"display_name": "Python 3 (ipykernel)",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "conda-env-DeepLearningLab-py"
|
"name": "python3"
|
||||||
},
|
},
|
||||||
"language_info": {
|
"language_info": {
|
||||||
"codemirror_mode": {
|
"codemirror_mode": {
|
||||||
|
73
Lab4/code/1.1.py
Normal file
73
Lab4/code/1.1.py
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
from utils import *
|
||||||
|
import ipdb
|
||||||
|
|
||||||
|
|
||||||
|
class My_Conv2d(nn.Module):
|
||||||
|
def __init__(self, in_channels:int, out_channels:int, kernel_size:int, padding:int=0, bias=True):
|
||||||
|
super(My_Conv2d, self).__init__()
|
||||||
|
self.has_bias = bias
|
||||||
|
self.in_channels = in_channels
|
||||||
|
self.out_channels = out_channels
|
||||||
|
self.kernel_size = kernel_size
|
||||||
|
self.padding = padding
|
||||||
|
self.weight = nn.Parameter(torch.Tensor(out_channels, in_channels, kernel_size, kernel_size))
|
||||||
|
nn.init.xavier_uniform_(self.weight)
|
||||||
|
if self.has_bias:
|
||||||
|
self.bias = nn.Parameter(torch.zeros(out_channels, requires_grad=True, dtype=torch.float32))
|
||||||
|
|
||||||
|
def forward(self, x):
|
||||||
|
batch_size, _, input_height, input_width = x.shape
|
||||||
|
if self.padding > 0:
|
||||||
|
x = F.pad(x, (self.padding, self.padding, self.padding, self.padding))
|
||||||
|
x = F.unfold(x, kernel_size=self.kernel_size)
|
||||||
|
x = x.permute(0, 2, 1).contiguous()
|
||||||
|
weight_unfold = self.weight.view(self.out_channels, -1).t()
|
||||||
|
x = torch.matmul(x, weight_unfold)
|
||||||
|
if self.has_bias:
|
||||||
|
x += self.bias
|
||||||
|
output_height = input_height + 2 * self.padding - self.kernel_size + 1
|
||||||
|
output_width = input_width + 2 * self.padding - self.kernel_size + 1
|
||||||
|
x = x.view(batch_size, output_height, output_width, self.out_channels).permute(0, 3, 1, 2).contiguous()
|
||||||
|
return x
|
||||||
|
|
||||||
|
|
||||||
|
class Model_Vehicle_CLS_1_1(nn.Module):
|
||||||
|
def __init__(self, num_classes=3):
|
||||||
|
super(Model_Vehicle_CLS_1_1, self).__init__()
|
||||||
|
self.conv1 = My_Conv2d(in_channels=3, out_channels=128, kernel_size=3, padding=1, bias=False)
|
||||||
|
self.bn1 = nn.BatchNorm2d(128)
|
||||||
|
self.conv2 = My_Conv2d(in_channels=128, out_channels=512, kernel_size=3, padding=1, bias=False)
|
||||||
|
self.bn2 = nn.BatchNorm2d(512)
|
||||||
|
self.fc = nn.Linear(in_features=512, out_features=num_classes)
|
||||||
|
|
||||||
|
def forward(self, x):
|
||||||
|
x = F.relu(self.bn1(self.conv1(x)))
|
||||||
|
x = F.relu(self.bn2(self.conv2(x)))
|
||||||
|
x = F.avg_pool2d(x, 32)
|
||||||
|
x = x.view(x.size(0), -1)
|
||||||
|
x = self.fc(x)
|
||||||
|
return x
|
||||||
|
|
||||||
|
|
||||||
|
class Model_Haze_Removal_1_1(nn.Module):
|
||||||
|
def __init__(self):
|
||||||
|
super(Model_Haze_Removal_1_1, self).__init__()
|
||||||
|
self.conv1 = My_Conv2d(in_channels=3, out_channels=16, kernel_size=3, padding=1, bias=False)
|
||||||
|
self.bn1 = nn.BatchNorm2d(16)
|
||||||
|
self.conv2 = My_Conv2d(in_channels=16, out_channels=48, kernel_size=5, padding=2, bias=False)
|
||||||
|
self.bn2 = nn.BatchNorm2d(48)
|
||||||
|
self.conv3 = My_Conv2d(in_channels=48, out_channels=3, kernel_size=3, padding=1)
|
||||||
|
|
||||||
|
def forward(self, x):
|
||||||
|
x = F.relu(self.bn1(self.conv1(x)))
|
||||||
|
x = F.relu(self.bn2(self.conv2(x)))
|
||||||
|
x = self.conv3(x)
|
||||||
|
return x
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
model = Model_Vehicle_CLS_1_1()
|
||||||
|
train_Vehicle_CLS(model=model, learning_rate=4e-4, batch_size=256)
|
||||||
|
|
||||||
|
model = Model_Haze_Removal_1_1()
|
||||||
|
train_Haze_Removal(model=model, learning_rate=5e-3, batch_size=16)
|
43
Lab4/code/1.2.py
Normal file
43
Lab4/code/1.2.py
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
from utils import *
|
||||||
|
import ipdb
|
||||||
|
|
||||||
|
class Model_Vehicle_CLS_1_2(nn.Module):
|
||||||
|
def __init__(self, num_classes=3):
|
||||||
|
super(Model_Vehicle_CLS_1_2, self).__init__()
|
||||||
|
self.conv1 = nn.Conv2d(in_channels=3, out_channels=128, kernel_size=3, padding=1, bias=False)
|
||||||
|
self.bn1 = nn.BatchNorm2d(128)
|
||||||
|
self.conv2 = nn.Conv2d(in_channels=128, out_channels=512, kernel_size=3, padding=1, bias=False)
|
||||||
|
self.bn2 = nn.BatchNorm2d(512)
|
||||||
|
self.fc = nn.Linear(in_features=512, out_features=num_classes)
|
||||||
|
|
||||||
|
def forward(self, x):
|
||||||
|
x = F.relu(self.bn1(self.conv1(x)))
|
||||||
|
x = F.relu(self.bn2(self.conv2(x)))
|
||||||
|
x = F.avg_pool2d(x, 32)
|
||||||
|
x = x.view(x.size(0), -1)
|
||||||
|
x = self.fc(x)
|
||||||
|
return x
|
||||||
|
|
||||||
|
|
||||||
|
class Model_Haze_Removal_1_2(nn.Module):
|
||||||
|
def __init__(self):
|
||||||
|
super(Model_Haze_Removal_1_2, self).__init__()
|
||||||
|
self.conv1 = nn.Conv2d(in_channels=3, out_channels=16, kernel_size=3, padding=1, bias=False)
|
||||||
|
self.bn1 = nn.BatchNorm2d(16)
|
||||||
|
self.conv2 = nn.Conv2d(in_channels=16, out_channels=48, kernel_size=5, padding=2, bias=False)
|
||||||
|
self.bn2 = nn.BatchNorm2d(48)
|
||||||
|
self.conv3 = nn.Conv2d(in_channels=48, out_channels=3, kernel_size=3, padding=1)
|
||||||
|
|
||||||
|
def forward(self, x):
|
||||||
|
x = F.relu(self.bn1(self.conv1(x)))
|
||||||
|
x = F.relu(self.bn2(self.conv2(x)))
|
||||||
|
x = self.conv3(x)
|
||||||
|
return x
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
model = Model_Vehicle_CLS_1_2()
|
||||||
|
train_Vehicle_CLS(model=model, learning_rate=4e-4, batch_size=64)
|
||||||
|
|
||||||
|
model = Model_Haze_Removal_1_2()
|
||||||
|
train_Haze_Removal(model=model, learning_rate=5e-3, batch_size=16)
|
215
Lab4/code/1.3.py
Normal file
215
Lab4/code/1.3.py
Normal file
@ -0,0 +1,215 @@
|
|||||||
|
from utils import *
|
||||||
|
|
||||||
|
class Model_Vehicle_CLS_1_3_1(nn.Module):
|
||||||
|
def __init__(self, num_classes=3):
|
||||||
|
super(Model_Vehicle_CLS_1_3_1, self).__init__()
|
||||||
|
self.conv1 = nn.Sequential(
|
||||||
|
nn.Conv2d(in_channels=3, out_channels=512, kernel_size=3, padding=1, bias=False),
|
||||||
|
nn.BatchNorm2d(512),
|
||||||
|
)
|
||||||
|
self.fc = nn.Linear(in_features=512, out_features=num_classes)
|
||||||
|
|
||||||
|
def forward(self, x):
|
||||||
|
x = F.relu(self.conv1(x))
|
||||||
|
x = F.avg_pool2d(x, 32)
|
||||||
|
x = x.view(x.size(0), -1)
|
||||||
|
x = self.fc(x)
|
||||||
|
return x
|
||||||
|
|
||||||
|
|
||||||
|
class Model_Vehicle_CLS_1_3_2(nn.Module):
|
||||||
|
def __init__(self, num_classes=3):
|
||||||
|
super(Model_Vehicle_CLS_1_3_2, self).__init__()
|
||||||
|
self.conv1 = nn.Sequential(
|
||||||
|
nn.Conv2d(in_channels=3, out_channels=128, kernel_size=3, padding=1, bias=False),
|
||||||
|
nn.BatchNorm2d(128),
|
||||||
|
)
|
||||||
|
self.conv2 = nn.Sequential(
|
||||||
|
nn.Conv2d(in_channels=128, out_channels=512, kernel_size=3, padding=1, bias=False),
|
||||||
|
nn.BatchNorm2d(512),
|
||||||
|
)
|
||||||
|
self.fc = nn.Linear(in_features=512, out_features=num_classes, bias=False)
|
||||||
|
|
||||||
|
def forward(self, x):
|
||||||
|
x = F.relu(self.conv1(x))
|
||||||
|
x = F.relu(self.conv2(x))
|
||||||
|
x = F.avg_pool2d(x, 32)
|
||||||
|
x = x.view(x.size(0), -1)
|
||||||
|
x = self.fc(x)
|
||||||
|
return x
|
||||||
|
|
||||||
|
|
||||||
|
class Model_Vehicle_CLS_1_3_3(nn.Module):
|
||||||
|
def __init__(self, num_classes=3):
|
||||||
|
super(Model_Vehicle_CLS_1_3_3, self).__init__()
|
||||||
|
self.conv1 = nn.Sequential(
|
||||||
|
nn.Conv2d(in_channels=3, out_channels=64, kernel_size=3, padding=1, bias=False),
|
||||||
|
nn.BatchNorm2d(64),
|
||||||
|
)
|
||||||
|
self.conv2 = nn.Sequential(
|
||||||
|
nn.Conv2d(in_channels=64, out_channels=256, kernel_size=3, padding=1, bias=False),
|
||||||
|
nn.BatchNorm2d(256),
|
||||||
|
)
|
||||||
|
self.conv3 = nn.Sequential(
|
||||||
|
nn.Conv2d(in_channels=256, out_channels=512, kernel_size=3, padding=1, bias=False),
|
||||||
|
nn.BatchNorm2d(512),
|
||||||
|
)
|
||||||
|
self.fc = nn.Linear(in_features=512, out_features=num_classes)
|
||||||
|
|
||||||
|
def forward(self, x):
|
||||||
|
x = F.relu(self.conv1(x))
|
||||||
|
x = F.relu(self.conv2(x))
|
||||||
|
x = F.relu(self.conv3(x))
|
||||||
|
x = F.avg_pool2d(x, 32)
|
||||||
|
x = x.view(x.size(0), -1)
|
||||||
|
x = self.fc(x)
|
||||||
|
return x
|
||||||
|
|
||||||
|
|
||||||
|
class Model_Vehicle_CLS_1_3_4(nn.Module):
|
||||||
|
def __init__(self, num_classes=3):
|
||||||
|
super(Model_Vehicle_CLS_1_3_4, self).__init__()
|
||||||
|
self.conv1 = nn.Sequential(
|
||||||
|
nn.Conv2d(in_channels=3, out_channels=64, kernel_size=3, padding=1, bias=False),
|
||||||
|
nn.BatchNorm2d(64),
|
||||||
|
)
|
||||||
|
self.conv2 = nn.Sequential(
|
||||||
|
nn.Conv2d(in_channels=64, out_channels=128, kernel_size=3, padding=1, bias=False),
|
||||||
|
nn.BatchNorm2d(128),
|
||||||
|
)
|
||||||
|
self.conv3 = nn.Sequential(
|
||||||
|
nn.Conv2d(in_channels=128, out_channels=256, kernel_size=3, padding=1, bias=False),
|
||||||
|
nn.BatchNorm2d(256),
|
||||||
|
)
|
||||||
|
self.conv4 = nn.Sequential(
|
||||||
|
nn.Conv2d(in_channels=256, out_channels=512, kernel_size=3, padding=1, bias=False),
|
||||||
|
nn.BatchNorm2d(512),
|
||||||
|
)
|
||||||
|
self.fc = nn.Linear(in_features=512, out_features=num_classes)
|
||||||
|
|
||||||
|
def forward(self, x):
|
||||||
|
x = F.relu(self.conv1(x))
|
||||||
|
x = F.relu(self.conv2(x))
|
||||||
|
x = F.relu(self.conv3(x))
|
||||||
|
x = F.relu(self.conv4(x))
|
||||||
|
x = F.avg_pool2d(x, 32)
|
||||||
|
x = x.view(x.size(0), -1)
|
||||||
|
x = self.fc(x)
|
||||||
|
return x
|
||||||
|
|
||||||
|
|
||||||
|
class Model_Haze_Removal_1_3_1(nn.Module):
|
||||||
|
def __init__(self):
|
||||||
|
super(Model_Haze_Removal_1_3_1, self).__init__()
|
||||||
|
self.conv1 = nn.Sequential(
|
||||||
|
nn.Conv2d(in_channels=3, out_channels=16, kernel_size=3, padding=1, bias=False),
|
||||||
|
nn.BatchNorm2d(16),
|
||||||
|
)
|
||||||
|
self.conv2 = nn.Sequential(
|
||||||
|
nn.Conv2d(in_channels=16, out_channels=48, kernel_size=3, padding=1, bias=False),
|
||||||
|
nn.BatchNorm2d(48),
|
||||||
|
)
|
||||||
|
self.conv3 = nn.Conv2d(in_channels=48, out_channels=3, kernel_size=3, padding=1)
|
||||||
|
|
||||||
|
def forward(self, x):
|
||||||
|
x = F.relu(self.conv1(x))
|
||||||
|
x = F.relu(self.conv2(x))
|
||||||
|
x = self.conv3(x)
|
||||||
|
return x
|
||||||
|
|
||||||
|
|
||||||
|
class Model_Haze_Removal_1_3_2(nn.Module):
|
||||||
|
def __init__(self):
|
||||||
|
super(Model_Haze_Removal_1_3_2, self).__init__()
|
||||||
|
self.conv1 = nn.Sequential(
|
||||||
|
nn.Conv2d(in_channels=3, out_channels=16, kernel_size=5, padding=2, bias=False),
|
||||||
|
nn.BatchNorm2d(16),
|
||||||
|
)
|
||||||
|
self.conv2 = nn.Sequential(
|
||||||
|
nn.Conv2d(in_channels=16, out_channels=48, kernel_size=5, padding=2, bias=False),
|
||||||
|
nn.BatchNorm2d(48),
|
||||||
|
)
|
||||||
|
self.conv3 = nn.Conv2d(in_channels=48, out_channels=3, kernel_size=5, padding=2)
|
||||||
|
|
||||||
|
def forward(self, x):
|
||||||
|
x = F.relu(self.conv1(x))
|
||||||
|
x = F.relu(self.conv2(x))
|
||||||
|
x = self.conv3(x)
|
||||||
|
return x
|
||||||
|
|
||||||
|
|
||||||
|
class Model_Haze_Removal_1_3_3(nn.Module):
|
||||||
|
def __init__(self):
|
||||||
|
super(Model_Haze_Removal_1_3_3, self).__init__()
|
||||||
|
self.conv1 = nn.Sequential(
|
||||||
|
nn.Conv2d(in_channels=3, out_channels=16, kernel_size=7, padding=3, bias=False),
|
||||||
|
nn.BatchNorm2d(16),
|
||||||
|
nn.ReLU(inplace=True),
|
||||||
|
)
|
||||||
|
self.conv2 = nn.Sequential(
|
||||||
|
nn.Conv2d(in_channels=16, out_channels=48, kernel_size=7, padding=3, bias=False),
|
||||||
|
nn.BatchNorm2d(48),
|
||||||
|
nn.ReLU(inplace=True),
|
||||||
|
)
|
||||||
|
self.conv3 = nn.Conv2d(in_channels=48, out_channels=3, kernel_size=7, padding=3)
|
||||||
|
|
||||||
|
def forward(self, x):
|
||||||
|
x = F.relu(self.conv1(x))
|
||||||
|
x = F.relu(self.conv2(x))
|
||||||
|
x = self.conv3(x)
|
||||||
|
return x
|
||||||
|
|
||||||
|
|
||||||
|
class Model_Haze_Removal_1_3_4(nn.Module):
|
||||||
|
def __init__(self):
|
||||||
|
super(Model_Haze_Removal_1_3_4, self).__init__()
|
||||||
|
self.conv1 = nn.Sequential(
|
||||||
|
nn.Conv2d(in_channels=3, out_channels=16, kernel_size=9, padding=4, bias=False),
|
||||||
|
nn.BatchNorm2d(16),
|
||||||
|
nn.ReLU(inplace=True),
|
||||||
|
)
|
||||||
|
self.conv2 = nn.Sequential(
|
||||||
|
nn.Conv2d(in_channels=16, out_channels=48, kernel_size=9, padding=4, bias=False),
|
||||||
|
nn.BatchNorm2d(48),
|
||||||
|
nn.ReLU(inplace=True),
|
||||||
|
)
|
||||||
|
self.conv3 = nn.Conv2d(in_channels=48, out_channels=3, kernel_size=9, padding=4)
|
||||||
|
|
||||||
|
def forward(self, x):
|
||||||
|
x = F.relu(self.conv1(x))
|
||||||
|
x = F.relu(self.conv2(x))
|
||||||
|
x = self.conv3(x)
|
||||||
|
return x
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
num_epochs = 61
|
||||||
|
learning_rate = 2e-4
|
||||||
|
batch_size = 256
|
||||||
|
models = [
|
||||||
|
Model_Vehicle_CLS_1_3_1,
|
||||||
|
Model_Vehicle_CLS_1_3_2,
|
||||||
|
Model_Vehicle_CLS_1_3_3,
|
||||||
|
Model_Vehicle_CLS_1_3_4,
|
||||||
|
]
|
||||||
|
for i in range(4):
|
||||||
|
model = models[i]()
|
||||||
|
print(f"卷积层层数={i + 1}")
|
||||||
|
train_loss, test_acc = train_Vehicle_CLS(model=model, learning_rate=learning_rate,
|
||||||
|
batch_size=batch_size, num_epochs=num_epochs)
|
||||||
|
print()
|
||||||
|
|
||||||
|
num_epochs = 61
|
||||||
|
learning_rate = 8e-3
|
||||||
|
batch_size = 64
|
||||||
|
models = [
|
||||||
|
Model_Haze_Removal_1_3_1,
|
||||||
|
Model_Haze_Removal_1_3_2,
|
||||||
|
Model_Haze_Removal_1_3_3,
|
||||||
|
Model_Haze_Removal_1_3_4,
|
||||||
|
]
|
||||||
|
for i in range(4):
|
||||||
|
model = models[i]()
|
||||||
|
print(f"卷积核大小={3 + 2 * i}")
|
||||||
|
train_loss, test_loss = train_Haze_Removal(model=model, learning_rate=learning_rate, batch_size=batch_size, num_epochs=num_epochs)
|
||||||
|
print()
|
168
Lab4/code/2.py
Normal file
168
Lab4/code/2.py
Normal file
@ -0,0 +1,168 @@
|
|||||||
|
from utils import *
|
||||||
|
|
||||||
|
class Model_Vehicle_CLS_2_1(nn.Module):
|
||||||
|
def __init__(self, num_classes=3):
|
||||||
|
super(Model_Vehicle_CLS_2_1, self).__init__()
|
||||||
|
self.conv1 = nn.Sequential(
|
||||||
|
nn.Conv2d(in_channels=3, out_channels=16, kernel_size=3, padding=1, dilation=1, bias=False),
|
||||||
|
nn.BatchNorm2d(16),
|
||||||
|
nn.ReLU(inplace=True),
|
||||||
|
nn.Conv2d(in_channels=16, out_channels=32, kernel_size=3, padding=1, dilation=1, bias=False),
|
||||||
|
nn.BatchNorm2d(32),
|
||||||
|
nn.ReLU(inplace=True),
|
||||||
|
nn.Conv2d(in_channels=32, out_channels=64, kernel_size=3, padding=1, dilation=1, bias=False),
|
||||||
|
nn.BatchNorm2d(64),
|
||||||
|
nn.ReLU(inplace=True),
|
||||||
|
)
|
||||||
|
self.conv2 = nn.Sequential(
|
||||||
|
nn.Conv2d(in_channels=64, out_channels=128, kernel_size=3, padding=1, dilation=1, bias=False),
|
||||||
|
nn.BatchNorm2d(128),
|
||||||
|
nn.ReLU(inplace=True),
|
||||||
|
nn.Conv2d(in_channels=128, out_channels=256, kernel_size=3, padding=1, dilation=1, bias=False),
|
||||||
|
nn.BatchNorm2d(256),
|
||||||
|
nn.ReLU(inplace=True),
|
||||||
|
nn.Conv2d(in_channels=256, out_channels=512, kernel_size=3, padding=1, dilation=1, bias=False),
|
||||||
|
nn.BatchNorm2d(512),
|
||||||
|
nn.ReLU(inplace=True),
|
||||||
|
)
|
||||||
|
self.fc = nn.Linear(in_features=512, out_features=num_classes)
|
||||||
|
|
||||||
|
def forward(self, x):
|
||||||
|
x = self.conv1(x)
|
||||||
|
x = self.conv2(x)
|
||||||
|
x = F.avg_pool2d(x, 32)
|
||||||
|
x = x.view(x.size(0), -1)
|
||||||
|
x = self.fc(x)
|
||||||
|
return x
|
||||||
|
|
||||||
|
|
||||||
|
class Model_Vehicle_CLS_2_2(nn.Module):
|
||||||
|
def __init__(self, num_classes=3):
|
||||||
|
super(Model_Vehicle_CLS_2_2, self).__init__()
|
||||||
|
self.conv1 = nn.Sequential(
|
||||||
|
nn.Conv2d(in_channels=3, out_channels=16, kernel_size=3, padding=1, dilation=1, bias=False),
|
||||||
|
nn.BatchNorm2d(16),
|
||||||
|
nn.ReLU(inplace=True),
|
||||||
|
nn.Conv2d(in_channels=16, out_channels=32, kernel_size=3, padding=2, dilation=2, bias=False),
|
||||||
|
nn.BatchNorm2d(32),
|
||||||
|
nn.ReLU(inplace=True),
|
||||||
|
nn.Conv2d(in_channels=32, out_channels=64, kernel_size=3, padding=5, dilation=5, bias=False),
|
||||||
|
nn.BatchNorm2d(64),
|
||||||
|
nn.ReLU(inplace=True),
|
||||||
|
)
|
||||||
|
self.conv2 = nn.Sequential(
|
||||||
|
nn.Conv2d(in_channels=64, out_channels=128, kernel_size=3, padding=1, dilation=1, bias=False),
|
||||||
|
nn.BatchNorm2d(128),
|
||||||
|
nn.ReLU(inplace=True),
|
||||||
|
nn.Conv2d(in_channels=128, out_channels=256, kernel_size=3, padding=2, dilation=2, bias=False),
|
||||||
|
nn.BatchNorm2d(256),
|
||||||
|
nn.ReLU(inplace=True),
|
||||||
|
nn.Conv2d(in_channels=256, out_channels=512, kernel_size=3, padding=5, dilation=5, bias=False),
|
||||||
|
nn.BatchNorm2d(512),
|
||||||
|
nn.ReLU(inplace=True),
|
||||||
|
)
|
||||||
|
self.fc = nn.Linear(in_features=512, out_features=num_classes)
|
||||||
|
|
||||||
|
def forward(self, x):
|
||||||
|
x = self.conv1(x)
|
||||||
|
x = self.conv2(x)
|
||||||
|
x = F.avg_pool2d(x, 32)
|
||||||
|
x = x.view(x.size(0), -1)
|
||||||
|
x = self.fc(x)
|
||||||
|
return x
|
||||||
|
|
||||||
|
|
||||||
|
class Model_Vehicle_CLS_2_3(nn.Module):
|
||||||
|
def __init__(self, num_classes=3):
|
||||||
|
super(Model_Vehicle_CLS_2_3, self).__init__()
|
||||||
|
self.conv1 = nn.Sequential(
|
||||||
|
nn.Conv2d(in_channels=3, out_channels=16, kernel_size=3, padding=1, dilation=1, bias=False),
|
||||||
|
nn.BatchNorm2d(16),
|
||||||
|
nn.ReLU(inplace=True),
|
||||||
|
nn.Conv2d(in_channels=16, out_channels=32, kernel_size=3, padding=3, dilation=3, bias=False),
|
||||||
|
nn.BatchNorm2d(32),
|
||||||
|
nn.ReLU(inplace=True),
|
||||||
|
nn.Conv2d(in_channels=32, out_channels=64, kernel_size=3, padding=5, dilation=5, bias=False),
|
||||||
|
nn.BatchNorm2d(64),
|
||||||
|
nn.ReLU(inplace=True),
|
||||||
|
)
|
||||||
|
self.conv2 = nn.Sequential(
|
||||||
|
nn.Conv2d(in_channels=64, out_channels=128, kernel_size=3, padding=1, dilation=1, bias=False),
|
||||||
|
nn.BatchNorm2d(128),
|
||||||
|
nn.ReLU(inplace=True),
|
||||||
|
nn.Conv2d(in_channels=128, out_channels=256, kernel_size=3, padding=3, dilation=3, bias=False),
|
||||||
|
nn.BatchNorm2d(256),
|
||||||
|
nn.ReLU(inplace=True),
|
||||||
|
nn.Conv2d(in_channels=256, out_channels=512, kernel_size=3, padding=5, dilation=5, bias=False),
|
||||||
|
nn.BatchNorm2d(512),
|
||||||
|
nn.ReLU(inplace=True),
|
||||||
|
)
|
||||||
|
self.fc = nn.Linear(in_features=512, out_features=num_classes)
|
||||||
|
|
||||||
|
def forward(self, x):
|
||||||
|
x = self.conv1(x)
|
||||||
|
x = self.conv2(x)
|
||||||
|
x = F.avg_pool2d(x, 32)
|
||||||
|
x = x.view(x.size(0), -1)
|
||||||
|
x = self.fc(x)
|
||||||
|
return x
|
||||||
|
|
||||||
|
|
||||||
|
class Model_Vehicle_CLS_2_4(nn.Module):
|
||||||
|
def __init__(self, num_classes=3):
|
||||||
|
super(Model_Vehicle_CLS_2_4, self).__init__()
|
||||||
|
self.conv1 = nn.Sequential(
|
||||||
|
nn.Conv2d(in_channels=3, out_channels=16, kernel_size=3, padding=1, dilation=1, bias=False),
|
||||||
|
nn.BatchNorm2d(16),
|
||||||
|
nn.ReLU(inplace=True),
|
||||||
|
nn.Conv2d(in_channels=16, out_channels=32, kernel_size=3, padding=3, dilation=3, bias=False),
|
||||||
|
nn.BatchNorm2d(32),
|
||||||
|
nn.ReLU(inplace=True),
|
||||||
|
nn.Conv2d(in_channels=32, out_channels=64, kernel_size=3, padding=7, dilation=7, bias=False),
|
||||||
|
nn.BatchNorm2d(64),
|
||||||
|
nn.ReLU(inplace=True),
|
||||||
|
)
|
||||||
|
self.conv2 = nn.Sequential(
|
||||||
|
nn.Conv2d(in_channels=64, out_channels=128, kernel_size=3, padding=1, dilation=1, bias=False),
|
||||||
|
nn.BatchNorm2d(128),
|
||||||
|
nn.ReLU(inplace=True),
|
||||||
|
nn.Conv2d(in_channels=128, out_channels=256, kernel_size=3, padding=3, dilation=3, bias=False),
|
||||||
|
nn.BatchNorm2d(256),
|
||||||
|
nn.ReLU(inplace=True),
|
||||||
|
nn.Conv2d(in_channels=256, out_channels=512, kernel_size=3, padding=7, dilation=7, bias=False),
|
||||||
|
nn.BatchNorm2d(512),
|
||||||
|
nn.ReLU(inplace=True),
|
||||||
|
)
|
||||||
|
self.fc = nn.Linear(in_features=512, out_features=num_classes)
|
||||||
|
|
||||||
|
def forward(self, x):
|
||||||
|
x = self.conv1(x)
|
||||||
|
x = self.conv2(x)
|
||||||
|
x = F.avg_pool2d(x, 32)
|
||||||
|
x = x.view(x.size(0), -1)
|
||||||
|
x = self.fc(x)
|
||||||
|
return x
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
num_epochs = 61
|
||||||
|
learning_rate = 1e-4
|
||||||
|
batch_size = 256
|
||||||
|
dilations = ["[[1, 1, 1], [1, 1, 1]]",
|
||||||
|
"[[1, 2, 5], [1, 2, 5]]",
|
||||||
|
"[[1, 3, 5], [1, 3, 5]]",
|
||||||
|
"[[1, 3, 7], [1, 3, 7]]"]
|
||||||
|
models = [
|
||||||
|
Model_Vehicle_CLS_2_1,
|
||||||
|
Model_Vehicle_CLS_2_2,
|
||||||
|
Model_Vehicle_CLS_2_3,
|
||||||
|
Model_Vehicle_CLS_2_4,
|
||||||
|
]
|
||||||
|
for i in range(4):
|
||||||
|
model = models[i]()
|
||||||
|
print("Dilation: " + dilations[i])
|
||||||
|
train_loss, test_acc = train_Vehicle_CLS(model=model, learning_rate=learning_rate,
|
||||||
|
batch_size=batch_size, num_epochs=num_epochs)
|
||||||
|
print()
|
||||||
|
|
||||||
|
|
63
Lab4/code/3.py
Normal file
63
Lab4/code/3.py
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
from utils import *
|
||||||
|
|
||||||
|
class BasicResidualBlock(nn.Module):
|
||||||
|
def __init__(self, in_channels, out_channels, stride=1):
|
||||||
|
super(BasicResidualBlock, self).__init__()
|
||||||
|
self.conv1 = nn.Conv2d(in_channels, out_channels, kernel_size=3, stride=stride, padding=1, bias=False)
|
||||||
|
self.bn1 = nn.BatchNorm2d(out_channels)
|
||||||
|
self.conv2 = nn.Conv2d(out_channels, out_channels, kernel_size=3, stride=1, padding=1, bias=False)
|
||||||
|
self.bn2 = nn.BatchNorm2d(out_channels)
|
||||||
|
self.shortcut = nn.Sequential()
|
||||||
|
if stride != 1 or in_channels != out_channels:
|
||||||
|
self.shortcut = nn.Sequential(
|
||||||
|
nn.Conv2d(in_channels, out_channels, kernel_size=1, stride=stride, bias=False),
|
||||||
|
nn.BatchNorm2d(out_channels)
|
||||||
|
)
|
||||||
|
|
||||||
|
def forward(self, x):
|
||||||
|
out = F.relu(self.bn1(self.conv1(x)))
|
||||||
|
out = self.bn2(self.conv2(out))
|
||||||
|
out += self.shortcut(x)
|
||||||
|
out = F.relu(out)
|
||||||
|
return out
|
||||||
|
|
||||||
|
|
||||||
|
class Model_Vehicle_CLS_3(nn.Module):
|
||||||
|
def __init__(self, num_classes=3):
|
||||||
|
super(Model_Vehicle_CLS_3, self).__init__()
|
||||||
|
self.conv1 = nn.Sequential(
|
||||||
|
nn.Conv2d(in_channels=3, out_channels=64, kernel_size=3, padding=1, bias=False),
|
||||||
|
nn.BatchNorm2d(64),
|
||||||
|
)
|
||||||
|
self.conv2 = BasicResidualBlock(in_channels=64, out_channels=64)
|
||||||
|
self.conv3 = BasicResidualBlock(in_channels=64, out_channels=64)
|
||||||
|
self.conv4 = BasicResidualBlock(in_channels=64, out_channels=128, stride=2)
|
||||||
|
self.conv5 = BasicResidualBlock(in_channels=128, out_channels=128)
|
||||||
|
self.conv6 = BasicResidualBlock(in_channels=128, out_channels=256, stride=2)
|
||||||
|
self.conv7 = BasicResidualBlock(in_channels=256, out_channels=256)
|
||||||
|
self.conv8 = BasicResidualBlock(in_channels=256, out_channels=512, stride=2)
|
||||||
|
self.conv9 = BasicResidualBlock(in_channels=512, out_channels=512)
|
||||||
|
self.fc = nn.Linear(in_features=512, out_features=num_classes)
|
||||||
|
|
||||||
|
def forward(self, x):
|
||||||
|
x = F.relu(self.conv1(x))
|
||||||
|
x = self.conv2(x)
|
||||||
|
x = self.conv3(x)
|
||||||
|
x = self.conv4(x)
|
||||||
|
x = self.conv5(x)
|
||||||
|
x = self.conv6(x)
|
||||||
|
x = self.conv7(x)
|
||||||
|
x = self.conv8(x)
|
||||||
|
x = self.conv9(x)
|
||||||
|
x = F.avg_pool2d(x, 4)
|
||||||
|
x = x.view(x.size(0), -1)
|
||||||
|
x = self.fc(x)
|
||||||
|
return x
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
num_epochs = 61
|
||||||
|
learning_rate = 15e-5
|
||||||
|
batch_size = 512
|
||||||
|
model = Model_Vehicle_CLS_3(num_classes=3)
|
||||||
|
train_loss, test_acc = train_Vehicle_CLS(model=model, learning_rate=learning_rate, batch_size=batch_size, num_epochs=num_epochs)
|
197
Lab4/code/utils.py
Normal file
197
Lab4/code/utils.py
Normal file
@ -0,0 +1,197 @@
|
|||||||
|
import torch
|
||||||
|
import torch.nn.functional as F
|
||||||
|
from torch.utils.data import DataLoader, Dataset
|
||||||
|
from torch import nn
|
||||||
|
from torchvision import transforms
|
||||||
|
from tqdm import tqdm
|
||||||
|
import os
|
||||||
|
import time
|
||||||
|
from PIL import Image
|
||||||
|
import pandas as pd
|
||||||
|
|
||||||
|
class Vehicle(Dataset):
|
||||||
|
def __init__(self, root:str="../dataset", train:bool=True, transform=None):
|
||||||
|
root = os.path.join(root, "Vehicles")
|
||||||
|
csv_file = os.path.join(root, "train.csv" if train else "test.csv")
|
||||||
|
self.data = pd.read_csv(csv_file).to_numpy().tolist()
|
||||||
|
self.root = root
|
||||||
|
self.transform = transform
|
||||||
|
|
||||||
|
def __len__(self):
|
||||||
|
return len(self.data)
|
||||||
|
|
||||||
|
def __getitem__(self, index):
|
||||||
|
img_name, label = self.data[index]
|
||||||
|
img_path = os.path.join(self.root, img_name)
|
||||||
|
image = Image.open(img_path)
|
||||||
|
label = int(label)
|
||||||
|
if self.transform:
|
||||||
|
image = self.transform(image)
|
||||||
|
return image, label
|
||||||
|
|
||||||
|
|
||||||
|
class Haze(Dataset):
|
||||||
|
def __init__(self, root:str="../dataset", train:bool=True, transform=None):
|
||||||
|
root = os.path.join(root, "Haze")
|
||||||
|
split_file = pd.read_csv(os.path.join(root, "split.csv")).to_numpy().tolist()
|
||||||
|
self.data = list()
|
||||||
|
for img, is_train in split_file:
|
||||||
|
if train and int(is_train) == 1:
|
||||||
|
self.data.append(img)
|
||||||
|
elif not train and int(is_train) == 0:
|
||||||
|
self.data.append(img)
|
||||||
|
self.root = root
|
||||||
|
self.transform = transform
|
||||||
|
|
||||||
|
def __len__(self):
|
||||||
|
return len(self.data)
|
||||||
|
|
||||||
|
def __getitem__(self, index):
|
||||||
|
img_name = self.data[index]
|
||||||
|
img_path = os.path.join(self.root, "raw/haze", img_name)
|
||||||
|
ground_truth_path = os.path.join(self.root, "raw/no_haze", img_name)
|
||||||
|
image = Image.open(img_path)
|
||||||
|
ground_truth = Image.open(ground_truth_path)
|
||||||
|
if self.transform:
|
||||||
|
image = self.transform(image)
|
||||||
|
ground_truth = self.transform(ground_truth)
|
||||||
|
return image, ground_truth
|
||||||
|
|
||||||
|
|
||||||
|
def train_Vehicle_CLS(model:nn.Module, learning_rate=1e-3, batch_size=64, num_epochs=51):
|
||||||
|
num_classes = 3
|
||||||
|
device = "cuda:0" if torch.cuda.is_available() else "cpu"
|
||||||
|
|
||||||
|
transform = transforms.Compose(
|
||||||
|
[
|
||||||
|
transforms.ToTensor(),
|
||||||
|
transforms.Resize((32, 32), antialias=True),
|
||||||
|
transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225]),
|
||||||
|
]
|
||||||
|
)
|
||||||
|
train_dataset = Vehicle(root="../dataset", train=True, transform=transform)
|
||||||
|
test_dataset = Vehicle(root="../dataset", train=False, transform=transform)
|
||||||
|
|
||||||
|
train_loader = DataLoader(dataset=train_dataset, batch_size=batch_size, shuffle=True, num_workers=14, pin_memory=True)
|
||||||
|
test_loader = DataLoader(dataset=test_dataset, batch_size=batch_size, num_workers=14, pin_memory=True)
|
||||||
|
|
||||||
|
model = model.to(device)
|
||||||
|
criterion = nn.CrossEntropyLoss()
|
||||||
|
optimizer = torch.optim.Adam(model.parameters(), lr=learning_rate)
|
||||||
|
|
||||||
|
train_loss = list()
|
||||||
|
test_acc = list()
|
||||||
|
for epoch in range(num_epochs):
|
||||||
|
model.train()
|
||||||
|
total_epoch_loss = 0
|
||||||
|
train_tik = time.time()
|
||||||
|
for index, (images, targets) in tqdm(enumerate(train_loader), total=len(train_loader)):
|
||||||
|
optimizer.zero_grad()
|
||||||
|
|
||||||
|
images = images.to(device)
|
||||||
|
targets = targets.to(device)
|
||||||
|
one_hot_targets = F.one_hot(targets, num_classes=num_classes).to(dtype=torch.float)
|
||||||
|
|
||||||
|
outputs = model(images)
|
||||||
|
loss = criterion(outputs, one_hot_targets)
|
||||||
|
total_epoch_loss += loss.item()
|
||||||
|
|
||||||
|
loss.backward()
|
||||||
|
optimizer.step()
|
||||||
|
train_tok = time.time()
|
||||||
|
|
||||||
|
model.eval()
|
||||||
|
with torch.no_grad():
|
||||||
|
total_epoch_acc = 0
|
||||||
|
test_tik = time.time()
|
||||||
|
for index, (image, targets) in tqdm(enumerate(test_loader), total=len(test_loader)):
|
||||||
|
image = image.to(device)
|
||||||
|
targets = targets.to(device)
|
||||||
|
|
||||||
|
outputs = model(image)
|
||||||
|
pred = F.softmax(outputs, dim=1)
|
||||||
|
total_epoch_acc += (pred.argmax(1) == targets).sum().item()
|
||||||
|
test_tok = time.time()
|
||||||
|
|
||||||
|
avg_epoch_acc = total_epoch_acc / len(test_dataset)
|
||||||
|
print(
|
||||||
|
f"Epoch [{epoch + 1}/{num_epochs}],",
|
||||||
|
f"Train Loss: {total_epoch_loss:.10f},",
|
||||||
|
f"Train Time: {1000 * (train_tok - train_tik):.2f}ms,",
|
||||||
|
f"Test Acc: {avg_epoch_acc * 100:.3f}%,",
|
||||||
|
f"Test Time: {1000 * (test_tok - test_tik):.2f}ms"
|
||||||
|
)
|
||||||
|
train_loss.append(total_epoch_loss)
|
||||||
|
test_acc.append(avg_epoch_acc)
|
||||||
|
print(f"最大显存使用量: {torch.cuda.max_memory_allocated() / (1024 * 1024):.2f}MiB")
|
||||||
|
torch.cuda.reset_peak_memory_stats()
|
||||||
|
return train_loss, test_acc
|
||||||
|
|
||||||
|
|
||||||
|
def train_Haze_Removal(model:nn.Module, learning_rate=1e-3, batch_size=64, num_epochs=51):
|
||||||
|
num_epochs = 50
|
||||||
|
device = "cuda:0" if torch.cuda.is_available() else "cpu"
|
||||||
|
|
||||||
|
transform = transforms.Compose(
|
||||||
|
[
|
||||||
|
transforms.ToTensor(),
|
||||||
|
transforms.Resize((224, 224), antialias=True),
|
||||||
|
]
|
||||||
|
)
|
||||||
|
train_dataset = Haze(root="../dataset", train=True, transform=transform)
|
||||||
|
test_dataset = Haze(root="../dataset", train=False, transform=transform)
|
||||||
|
|
||||||
|
train_loader = DataLoader(dataset=train_dataset, batch_size=batch_size, shuffle=True, num_workers=14, pin_memory=True)
|
||||||
|
test_loader = DataLoader(dataset=test_dataset, batch_size=batch_size, num_workers=14, pin_memory=True)
|
||||||
|
|
||||||
|
model = model.to(device)
|
||||||
|
criterion = nn.MSELoss()
|
||||||
|
optimizer = torch.optim.Adam(model.parameters(), lr=learning_rate)
|
||||||
|
|
||||||
|
train_loss = list()
|
||||||
|
test_loss = list()
|
||||||
|
for epoch in range(num_epochs):
|
||||||
|
model.train()
|
||||||
|
total_epoch_train_loss = 0
|
||||||
|
train_tik = time.time()
|
||||||
|
for index, (images, ground_truth) in tqdm(enumerate(train_loader), total=len(train_loader)):
|
||||||
|
optimizer.zero_grad()
|
||||||
|
|
||||||
|
images = images.to(device)
|
||||||
|
ground_truth = ground_truth.to(device)
|
||||||
|
|
||||||
|
outputs = model(images)
|
||||||
|
loss = criterion(outputs, ground_truth)
|
||||||
|
total_epoch_train_loss += loss.item()
|
||||||
|
|
||||||
|
loss.backward()
|
||||||
|
optimizer.step()
|
||||||
|
train_tok = time.time()
|
||||||
|
|
||||||
|
model.eval()
|
||||||
|
with torch.no_grad():
|
||||||
|
total_epoch_test_loss = 0
|
||||||
|
test_tik = time.time()
|
||||||
|
for index, (image, ground_truth) in tqdm(enumerate(test_loader), total=len(test_loader)):
|
||||||
|
image = image.to(device)
|
||||||
|
ground_truth = ground_truth.to(device)
|
||||||
|
|
||||||
|
outputs = model(image)
|
||||||
|
loss = criterion(outputs, ground_truth)
|
||||||
|
total_epoch_test_loss += loss.item()
|
||||||
|
test_tok = time.time()
|
||||||
|
|
||||||
|
print(
|
||||||
|
f"Epoch [{epoch + 1}/{num_epochs}],",
|
||||||
|
f"Train Loss: {total_epoch_train_loss:.10f},",
|
||||||
|
f"Train Time: {1000 * (train_tok - train_tik):.2f}ms,",
|
||||||
|
f"Test Loss: {total_epoch_test_loss:.10f},",
|
||||||
|
f"Test Time: {1000 * (test_tok - test_tik):.2f}ms"
|
||||||
|
)
|
||||||
|
train_loss.append(total_epoch_train_loss)
|
||||||
|
test_loss.append(total_epoch_test_loss)
|
||||||
|
print(f"最大显存使用量: {torch.cuda.max_memory_allocated() / (1024 * 1024):.2f}MiB")
|
||||||
|
torch.cuda.reset_peak_memory_stats()
|
||||||
|
return train_loss, test_loss
|
||||||
|
|
||||||
|
|
521
Lab4/dataset/Haze/split.csv
Normal file
521
Lab4/dataset/Haze/split.csv
Normal file
@ -0,0 +1,521 @@
|
|||||||
|
Image,Train
|
||||||
|
001.jpg,1
|
||||||
|
002.jpg,1
|
||||||
|
003.jpg,1
|
||||||
|
004.jpg,0
|
||||||
|
005.jpg,0
|
||||||
|
006.jpg,1
|
||||||
|
007.jpg,1
|
||||||
|
008.jpg,1
|
||||||
|
009.jpg,1
|
||||||
|
010.jpg,1
|
||||||
|
011.jpg,0
|
||||||
|
012.jpg,1
|
||||||
|
013.jpg,0
|
||||||
|
014.jpg,1
|
||||||
|
015.jpg,1
|
||||||
|
016.jpg,1
|
||||||
|
017.jpg,1
|
||||||
|
018.jpg,1
|
||||||
|
019.jpg,1
|
||||||
|
020.jpg,1
|
||||||
|
021.jpg,1
|
||||||
|
022.jpg,1
|
||||||
|
023.jpg,1
|
||||||
|
024.jpg,1
|
||||||
|
025.jpg,1
|
||||||
|
026.jpg,1
|
||||||
|
027.jpg,0
|
||||||
|
028.jpg,1
|
||||||
|
029.jpg,1
|
||||||
|
030.jpg,1
|
||||||
|
031.jpg,1
|
||||||
|
032.jpg,1
|
||||||
|
033.jpg,1
|
||||||
|
034.jpg,1
|
||||||
|
035.jpg,1
|
||||||
|
036.jpg,1
|
||||||
|
037.jpg,0
|
||||||
|
038.jpg,1
|
||||||
|
039.jpg,1
|
||||||
|
040.jpg,1
|
||||||
|
041.jpg,1
|
||||||
|
042.jpg,1
|
||||||
|
043.jpg,0
|
||||||
|
044.jpg,1
|
||||||
|
045.jpg,1
|
||||||
|
046.jpg,1
|
||||||
|
047.jpg,1
|
||||||
|
048.jpg,0
|
||||||
|
049.jpg,1
|
||||||
|
050.jpg,1
|
||||||
|
051.jpg,1
|
||||||
|
052.jpg,1
|
||||||
|
053.jpg,1
|
||||||
|
054.jpg,1
|
||||||
|
055.jpg,1
|
||||||
|
056.jpg,1
|
||||||
|
057.jpg,1
|
||||||
|
058.jpg,1
|
||||||
|
059.jpg,0
|
||||||
|
060.jpg,1
|
||||||
|
061.jpg,1
|
||||||
|
062.jpg,1
|
||||||
|
063.jpg,1
|
||||||
|
064.jpg,1
|
||||||
|
065.jpg,0
|
||||||
|
066.jpg,1
|
||||||
|
067.jpg,0
|
||||||
|
068.jpg,1
|
||||||
|
069.jpg,0
|
||||||
|
070.jpg,1
|
||||||
|
071.jpg,1
|
||||||
|
072.jpg,1
|
||||||
|
073.jpg,1
|
||||||
|
074.jpg,1
|
||||||
|
075.jpg,1
|
||||||
|
076.jpg,0
|
||||||
|
077.jpg,1
|
||||||
|
078.jpg,1
|
||||||
|
079.jpg,1
|
||||||
|
080.jpg,1
|
||||||
|
081.jpg,1
|
||||||
|
082.jpg,1
|
||||||
|
083.jpg,1
|
||||||
|
084.jpg,1
|
||||||
|
085.jpg,0
|
||||||
|
086.jpg,1
|
||||||
|
087.jpg,1
|
||||||
|
088.jpg,0
|
||||||
|
089.jpg,1
|
||||||
|
090.jpg,1
|
||||||
|
091.jpg,1
|
||||||
|
092.jpg,1
|
||||||
|
093.jpg,1
|
||||||
|
094.jpg,1
|
||||||
|
095.jpg,1
|
||||||
|
096.jpg,1
|
||||||
|
097.jpg,1
|
||||||
|
098.jpg,1
|
||||||
|
099.jpg,1
|
||||||
|
100.jpg,1
|
||||||
|
101.jpg,1
|
||||||
|
102.jpg,1
|
||||||
|
103.jpg,1
|
||||||
|
104.jpg,1
|
||||||
|
105.jpg,1
|
||||||
|
106.jpg,1
|
||||||
|
107.jpg,0
|
||||||
|
108.jpg,1
|
||||||
|
109.jpg,0
|
||||||
|
110.jpg,1
|
||||||
|
111.jpg,1
|
||||||
|
112.jpg,1
|
||||||
|
113.jpg,1
|
||||||
|
114.jpg,1
|
||||||
|
115.jpg,1
|
||||||
|
116.jpg,1
|
||||||
|
117.jpg,1
|
||||||
|
118.jpg,0
|
||||||
|
119.jpg,1
|
||||||
|
120.jpg,1
|
||||||
|
121.jpg,0
|
||||||
|
122.jpg,1
|
||||||
|
123.jpg,1
|
||||||
|
124.jpg,1
|
||||||
|
125.jpg,1
|
||||||
|
126.jpg,0
|
||||||
|
127.jpg,1
|
||||||
|
128.jpg,0
|
||||||
|
129.jpg,0
|
||||||
|
130.jpg,0
|
||||||
|
131.jpg,1
|
||||||
|
132.jpg,1
|
||||||
|
133.jpg,1
|
||||||
|
134.jpg,1
|
||||||
|
135.jpg,1
|
||||||
|
136.jpg,1
|
||||||
|
137.jpg,1
|
||||||
|
138.jpg,1
|
||||||
|
139.jpg,1
|
||||||
|
140.jpg,0
|
||||||
|
141.jpg,0
|
||||||
|
142.jpg,1
|
||||||
|
143.jpg,1
|
||||||
|
144.jpg,1
|
||||||
|
145.jpg,1
|
||||||
|
146.jpg,1
|
||||||
|
147.jpg,0
|
||||||
|
148.jpg,1
|
||||||
|
149.jpg,1
|
||||||
|
150.jpg,0
|
||||||
|
151.jpg,1
|
||||||
|
152.jpg,1
|
||||||
|
153.jpg,1
|
||||||
|
154.jpg,1
|
||||||
|
155.jpg,0
|
||||||
|
156.jpg,1
|
||||||
|
157.jpg,0
|
||||||
|
158.jpg,1
|
||||||
|
159.jpg,0
|
||||||
|
160.jpg,1
|
||||||
|
161.jpg,0
|
||||||
|
162.jpg,1
|
||||||
|
163.jpg,0
|
||||||
|
164.jpg,1
|
||||||
|
165.jpg,0
|
||||||
|
166.jpg,1
|
||||||
|
167.jpg,1
|
||||||
|
168.jpg,0
|
||||||
|
169.jpg,1
|
||||||
|
170.jpg,1
|
||||||
|
171.jpg,0
|
||||||
|
172.jpg,1
|
||||||
|
173.jpg,1
|
||||||
|
174.jpg,1
|
||||||
|
175.jpg,0
|
||||||
|
176.jpg,1
|
||||||
|
177.jpg,1
|
||||||
|
178.jpg,1
|
||||||
|
179.jpg,1
|
||||||
|
180.jpg,0
|
||||||
|
181.jpg,1
|
||||||
|
182.jpg,0
|
||||||
|
183.jpg,1
|
||||||
|
184.jpg,1
|
||||||
|
185.jpg,1
|
||||||
|
186.jpg,0
|
||||||
|
187.jpg,1
|
||||||
|
188.jpg,1
|
||||||
|
189.jpg,1
|
||||||
|
190.jpg,0
|
||||||
|
191.jpg,1
|
||||||
|
192.jpg,1
|
||||||
|
193.jpg,1
|
||||||
|
194.jpg,1
|
||||||
|
195.jpg,1
|
||||||
|
196.jpg,1
|
||||||
|
197.jpg,1
|
||||||
|
198.jpg,1
|
||||||
|
199.jpg,1
|
||||||
|
200.jpg,1
|
||||||
|
201.jpg,1
|
||||||
|
202.jpg,1
|
||||||
|
203.jpg,1
|
||||||
|
204.jpg,1
|
||||||
|
205.jpg,0
|
||||||
|
206.jpg,1
|
||||||
|
207.jpg,1
|
||||||
|
208.jpg,1
|
||||||
|
209.jpg,1
|
||||||
|
210.jpg,1
|
||||||
|
211.jpg,1
|
||||||
|
212.jpg,1
|
||||||
|
213.jpg,1
|
||||||
|
214.jpg,0
|
||||||
|
215.jpg,0
|
||||||
|
216.jpg,1
|
||||||
|
217.jpg,1
|
||||||
|
218.jpg,1
|
||||||
|
219.jpg,1
|
||||||
|
220.jpg,1
|
||||||
|
221.jpg,1
|
||||||
|
222.jpg,1
|
||||||
|
223.jpg,0
|
||||||
|
224.jpg,0
|
||||||
|
225.jpg,1
|
||||||
|
226.jpg,1
|
||||||
|
227.jpg,1
|
||||||
|
228.jpg,1
|
||||||
|
229.jpg,0
|
||||||
|
230.jpg,1
|
||||||
|
231.jpg,1
|
||||||
|
232.jpg,1
|
||||||
|
233.jpg,0
|
||||||
|
234.jpg,1
|
||||||
|
235.jpg,0
|
||||||
|
236.jpg,1
|
||||||
|
237.jpg,1
|
||||||
|
238.jpg,1
|
||||||
|
239.jpg,1
|
||||||
|
240.jpg,1
|
||||||
|
241.jpg,1
|
||||||
|
242.jpg,1
|
||||||
|
243.jpg,1
|
||||||
|
244.jpg,1
|
||||||
|
245.jpg,1
|
||||||
|
246.jpg,0
|
||||||
|
247.jpg,1
|
||||||
|
248.jpg,0
|
||||||
|
249.jpg,0
|
||||||
|
250.jpg,1
|
||||||
|
251.jpg,1
|
||||||
|
252.jpg,1
|
||||||
|
253.jpg,1
|
||||||
|
254.jpg,1
|
||||||
|
255.jpg,1
|
||||||
|
256.jpg,0
|
||||||
|
257.jpg,1
|
||||||
|
258.jpg,1
|
||||||
|
259.jpg,1
|
||||||
|
260.jpg,0
|
||||||
|
261.jpg,1
|
||||||
|
262.jpg,0
|
||||||
|
263.jpg,1
|
||||||
|
264.jpg,1
|
||||||
|
265.jpg,0
|
||||||
|
266.jpg,0
|
||||||
|
267.jpg,0
|
||||||
|
268.jpg,1
|
||||||
|
269.jpg,1
|
||||||
|
270.jpg,1
|
||||||
|
271.jpg,1
|
||||||
|
272.jpg,1
|
||||||
|
273.jpg,1
|
||||||
|
274.jpg,1
|
||||||
|
275.jpg,1
|
||||||
|
276.jpg,1
|
||||||
|
277.jpg,1
|
||||||
|
278.jpg,1
|
||||||
|
279.jpg,1
|
||||||
|
280.jpg,0
|
||||||
|
281.jpg,1
|
||||||
|
282.jpg,1
|
||||||
|
283.jpg,1
|
||||||
|
284.jpg,1
|
||||||
|
285.jpg,1
|
||||||
|
286.jpg,0
|
||||||
|
287.jpg,1
|
||||||
|
288.jpg,1
|
||||||
|
289.jpg,1
|
||||||
|
290.jpg,1
|
||||||
|
291.jpg,1
|
||||||
|
292.jpg,1
|
||||||
|
293.jpg,0
|
||||||
|
294.jpg,1
|
||||||
|
295.jpg,1
|
||||||
|
296.jpg,0
|
||||||
|
297.jpg,1
|
||||||
|
298.jpg,1
|
||||||
|
299.jpg,0
|
||||||
|
300.jpg,1
|
||||||
|
301.jpg,1
|
||||||
|
302.jpg,0
|
||||||
|
303.jpg,1
|
||||||
|
304.jpg,0
|
||||||
|
305.jpg,1
|
||||||
|
306.jpg,1
|
||||||
|
307.jpg,1
|
||||||
|
308.jpg,1
|
||||||
|
309.jpg,1
|
||||||
|
310.jpg,1
|
||||||
|
311.jpg,0
|
||||||
|
312.jpg,1
|
||||||
|
313.jpg,1
|
||||||
|
314.jpg,0
|
||||||
|
315.jpg,1
|
||||||
|
316.jpg,1
|
||||||
|
317.jpg,1
|
||||||
|
318.jpg,1
|
||||||
|
319.jpg,1
|
||||||
|
320.jpg,1
|
||||||
|
321.jpg,0
|
||||||
|
322.jpg,1
|
||||||
|
323.jpg,1
|
||||||
|
324.jpg,0
|
||||||
|
325.jpg,1
|
||||||
|
326.jpg,1
|
||||||
|
327.jpg,0
|
||||||
|
328.jpg,1
|
||||||
|
329.jpg,1
|
||||||
|
330.jpg,1
|
||||||
|
331.jpg,1
|
||||||
|
332.jpg,0
|
||||||
|
333.jpg,1
|
||||||
|
334.jpg,0
|
||||||
|
335.jpg,1
|
||||||
|
336.jpg,1
|
||||||
|
337.jpg,1
|
||||||
|
338.jpg,1
|
||||||
|
339.jpg,1
|
||||||
|
340.jpg,1
|
||||||
|
341.jpg,1
|
||||||
|
342.jpg,1
|
||||||
|
343.jpg,1
|
||||||
|
344.jpg,1
|
||||||
|
345.jpg,0
|
||||||
|
346.jpg,1
|
||||||
|
347.jpg,1
|
||||||
|
348.jpg,1
|
||||||
|
349.jpg,1
|
||||||
|
350.jpg,1
|
||||||
|
351.jpg,1
|
||||||
|
352.jpg,1
|
||||||
|
353.jpg,1
|
||||||
|
354.jpg,0
|
||||||
|
355.jpg,1
|
||||||
|
356.jpg,0
|
||||||
|
357.jpg,1
|
||||||
|
358.jpg,0
|
||||||
|
359.jpg,0
|
||||||
|
360.jpg,1
|
||||||
|
361.jpg,0
|
||||||
|
362.jpg,1
|
||||||
|
363.jpg,0
|
||||||
|
364.jpg,1
|
||||||
|
365.jpg,1
|
||||||
|
366.jpg,1
|
||||||
|
367.jpg,1
|
||||||
|
368.jpg,1
|
||||||
|
369.jpg,0
|
||||||
|
370.jpg,0
|
||||||
|
371.jpg,1
|
||||||
|
372.jpg,0
|
||||||
|
373.jpg,1
|
||||||
|
374.jpg,1
|
||||||
|
375.jpg,1
|
||||||
|
376.jpg,1
|
||||||
|
377.jpg,0
|
||||||
|
378.jpg,0
|
||||||
|
379.jpg,1
|
||||||
|
380.jpg,1
|
||||||
|
381.jpg,1
|
||||||
|
382.jpg,1
|
||||||
|
383.jpg,1
|
||||||
|
384.jpg,1
|
||||||
|
385.jpg,1
|
||||||
|
386.jpg,1
|
||||||
|
387.jpg,1
|
||||||
|
388.jpg,1
|
||||||
|
389.jpg,1
|
||||||
|
390.jpg,0
|
||||||
|
391.jpg,0
|
||||||
|
392.jpg,1
|
||||||
|
393.jpg,1
|
||||||
|
394.jpg,1
|
||||||
|
395.jpg,1
|
||||||
|
396.jpg,1
|
||||||
|
397.jpg,1
|
||||||
|
398.jpg,0
|
||||||
|
399.jpg,1
|
||||||
|
400.jpg,1
|
||||||
|
401.jpg,0
|
||||||
|
402.jpg,1
|
||||||
|
403.jpg,1
|
||||||
|
404.jpg,1
|
||||||
|
405.jpg,0
|
||||||
|
406.jpg,0
|
||||||
|
407.jpg,1
|
||||||
|
408.jpg,1
|
||||||
|
409.jpg,1
|
||||||
|
410.jpg,1
|
||||||
|
411.jpg,0
|
||||||
|
412.jpg,1
|
||||||
|
413.jpg,1
|
||||||
|
414.jpg,1
|
||||||
|
415.jpg,1
|
||||||
|
416.jpg,1
|
||||||
|
417.jpg,1
|
||||||
|
418.jpg,1
|
||||||
|
419.jpg,1
|
||||||
|
420.jpg,1
|
||||||
|
421.jpg,0
|
||||||
|
422.jpg,0
|
||||||
|
423.jpg,1
|
||||||
|
424.jpg,1
|
||||||
|
425.jpg,0
|
||||||
|
426.jpg,1
|
||||||
|
427.jpg,1
|
||||||
|
428.jpg,1
|
||||||
|
429.jpg,0
|
||||||
|
430.jpg,0
|
||||||
|
431.jpg,1
|
||||||
|
432.jpg,1
|
||||||
|
433.jpg,1
|
||||||
|
434.jpg,1
|
||||||
|
435.jpg,1
|
||||||
|
436.jpg,1
|
||||||
|
437.jpg,1
|
||||||
|
438.jpg,1
|
||||||
|
439.jpg,1
|
||||||
|
440.jpg,1
|
||||||
|
441.jpg,1
|
||||||
|
442.jpg,1
|
||||||
|
443.jpg,1
|
||||||
|
444.jpg,1
|
||||||
|
445.jpg,1
|
||||||
|
446.jpg,1
|
||||||
|
447.jpg,1
|
||||||
|
448.jpg,1
|
||||||
|
449.jpg,1
|
||||||
|
450.jpg,1
|
||||||
|
451.jpg,1
|
||||||
|
452.jpg,1
|
||||||
|
453.jpg,1
|
||||||
|
454.jpg,1
|
||||||
|
455.jpg,1
|
||||||
|
456.jpg,1
|
||||||
|
457.jpg,1
|
||||||
|
458.jpg,1
|
||||||
|
459.jpg,1
|
||||||
|
460.jpg,1
|
||||||
|
461.jpg,1
|
||||||
|
462.jpg,1
|
||||||
|
463.jpg,0
|
||||||
|
464.jpg,1
|
||||||
|
465.jpg,1
|
||||||
|
466.jpg,1
|
||||||
|
467.jpg,1
|
||||||
|
468.jpg,1
|
||||||
|
469.jpg,1
|
||||||
|
470.jpg,1
|
||||||
|
471.jpg,1
|
||||||
|
472.jpg,1
|
||||||
|
473.jpg,1
|
||||||
|
474.jpg,1
|
||||||
|
475.jpg,1
|
||||||
|
476.jpg,1
|
||||||
|
477.jpg,1
|
||||||
|
478.jpg,1
|
||||||
|
479.jpg,1
|
||||||
|
480.jpg,1
|
||||||
|
481.jpg,1
|
||||||
|
482.jpg,1
|
||||||
|
483.jpg,1
|
||||||
|
484.jpg,0
|
||||||
|
485.jpg,1
|
||||||
|
486.jpg,1
|
||||||
|
487.jpg,1
|
||||||
|
488.jpg,1
|
||||||
|
489.jpg,1
|
||||||
|
490.jpg,1
|
||||||
|
491.jpg,1
|
||||||
|
492.jpg,0
|
||||||
|
493.jpg,1
|
||||||
|
494.jpg,1
|
||||||
|
495.jpg,1
|
||||||
|
496.jpg,1
|
||||||
|
497.jpg,1
|
||||||
|
498.jpg,1
|
||||||
|
499.jpg,1
|
||||||
|
500.jpg,1
|
||||||
|
501.jpg,1
|
||||||
|
502.jpg,1
|
||||||
|
503.jpg,1
|
||||||
|
504.jpg,1
|
||||||
|
505.jpg,1
|
||||||
|
506.jpg,0
|
||||||
|
507.jpg,0
|
||||||
|
508.jpg,0
|
||||||
|
509.jpg,1
|
||||||
|
510.jpg,1
|
||||||
|
511.jpg,1
|
||||||
|
512.jpg,0
|
||||||
|
513.jpg,0
|
||||||
|
514.jpg,1
|
||||||
|
515.jpg,1
|
||||||
|
516.jpg,1
|
||||||
|
517.jpg,1
|
||||||
|
518.jpg,1
|
||||||
|
519.jpg,1
|
||||||
|
520.jpg,0
|
|
16
Lab4/dataset/Haze/split_dataset.py
Normal file
16
Lab4/dataset/Haze/split_dataset.py
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
import os
|
||||||
|
import pandas as pd
|
||||||
|
import random
|
||||||
|
|
||||||
|
train_list = set()
|
||||||
|
|
||||||
|
img_list = [i for i in os.listdir("raw/haze") if i.endswith(".jpg")]
|
||||||
|
random.shuffle(img_list)
|
||||||
|
for img in img_list[ : int(len(img_list) * 0.8)]:
|
||||||
|
train_list.add(img)
|
||||||
|
img_list.sort()
|
||||||
|
data = list()
|
||||||
|
for img in img_list:
|
||||||
|
data.append([img, 1 if img in train_list else 0])
|
||||||
|
|
||||||
|
pd.DataFrame(data=data, columns=["Image", "Train"]).to_csv("./split.csv", index=False)
|
26
Lab4/dataset/Vehicles/split_dataset.py
Normal file
26
Lab4/dataset/Vehicles/split_dataset.py
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
import os
|
||||||
|
import random
|
||||||
|
import pandas as pd
|
||||||
|
|
||||||
|
train_list = list()
|
||||||
|
test_list = list()
|
||||||
|
|
||||||
|
root_dir = "raw"
|
||||||
|
class_index = 0
|
||||||
|
for vehicle in os.listdir(root_dir):
|
||||||
|
img_list = [i for i in os.listdir(os.path.join(root_dir, vehicle)) if i.endswith(".jpg")]
|
||||||
|
random.shuffle(img_list)
|
||||||
|
split_num = int(len(img_list) * 0.8)
|
||||||
|
for img in img_list[0 : split_num]:
|
||||||
|
train_list.append([os.path.join(root_dir, vehicle, img), class_index])
|
||||||
|
for img in img_list[split_num : ]:
|
||||||
|
test_list.append([os.path.join(root_dir, vehicle, img), class_index])
|
||||||
|
class_index += 1
|
||||||
|
|
||||||
|
train_list.sort()
|
||||||
|
test_list.sort()
|
||||||
|
|
||||||
|
pd.DataFrame(data=train_list, columns=["Vehicle", "Label"]).to_csv("./train.csv", index=False)
|
||||||
|
pd.DataFrame(data=test_list, columns=["Vehicle", "Label"]).to_csv("./test.csv", index=False)
|
||||||
|
|
||||||
|
|
273
Lab4/dataset/Vehicles/test.csv
Normal file
273
Lab4/dataset/Vehicles/test.csv
Normal file
@ -0,0 +1,273 @@
|
|||||||
|
Vehicle,Label
|
||||||
|
raw/bus/bus002.jpg,1
|
||||||
|
raw/bus/bus005.jpg,1
|
||||||
|
raw/bus/bus008.jpg,1
|
||||||
|
raw/bus/bus017.jpg,1
|
||||||
|
raw/bus/bus019.jpg,1
|
||||||
|
raw/bus/bus033.jpg,1
|
||||||
|
raw/bus/bus034.jpg,1
|
||||||
|
raw/bus/bus040.jpg,1
|
||||||
|
raw/bus/bus043.jpg,1
|
||||||
|
raw/bus/bus044.jpg,1
|
||||||
|
raw/bus/bus045.jpg,1
|
||||||
|
raw/bus/bus046.jpg,1
|
||||||
|
raw/bus/bus051.jpg,1
|
||||||
|
raw/bus/bus052.jpg,1
|
||||||
|
raw/bus/bus056.jpg,1
|
||||||
|
raw/bus/bus057.jpg,1
|
||||||
|
raw/bus/bus063.jpg,1
|
||||||
|
raw/bus/bus066.jpg,1
|
||||||
|
raw/bus/bus077.jpg,1
|
||||||
|
raw/bus/bus080.jpg,1
|
||||||
|
raw/bus/bus096.jpg,1
|
||||||
|
raw/bus/bus097.jpg,1
|
||||||
|
raw/bus/bus099.jpg,1
|
||||||
|
raw/bus/bus114.jpg,1
|
||||||
|
raw/bus/bus115.jpg,1
|
||||||
|
raw/bus/bus119.jpg,1
|
||||||
|
raw/bus/bus127.jpg,1
|
||||||
|
raw/bus/bus132.jpg,1
|
||||||
|
raw/bus/bus133.jpg,1
|
||||||
|
raw/bus/bus135.jpg,1
|
||||||
|
raw/bus/bus139.jpg,1
|
||||||
|
raw/bus/bus141.jpg,1
|
||||||
|
raw/bus/bus145.jpg,1
|
||||||
|
raw/bus/bus156.jpg,1
|
||||||
|
raw/bus/bus170.jpg,1
|
||||||
|
raw/bus/bus173.jpg,1
|
||||||
|
raw/bus/bus183.jpg,1
|
||||||
|
raw/bus/bus190.jpg,1
|
||||||
|
raw/bus/bus192.jpg,1
|
||||||
|
raw/bus/bus200.jpg,1
|
||||||
|
raw/bus/bus201.jpg,1
|
||||||
|
raw/bus/bus209.jpg,1
|
||||||
|
raw/bus/bus213.jpg,1
|
||||||
|
raw/bus/bus218.jpg,1
|
||||||
|
raw/car/car002.jpg,0
|
||||||
|
raw/car/car012.jpg,0
|
||||||
|
raw/car/car018.jpg,0
|
||||||
|
raw/car/car025.jpg,0
|
||||||
|
raw/car/car030.jpg,0
|
||||||
|
raw/car/car034.jpg,0
|
||||||
|
raw/car/car036.jpg,0
|
||||||
|
raw/car/car047.jpg,0
|
||||||
|
raw/car/car053.jpg,0
|
||||||
|
raw/car/car054.jpg,0
|
||||||
|
raw/car/car058.jpg,0
|
||||||
|
raw/car/car060.jpg,0
|
||||||
|
raw/car/car062.jpg,0
|
||||||
|
raw/car/car063.jpg,0
|
||||||
|
raw/car/car066.jpg,0
|
||||||
|
raw/car/car072.jpg,0
|
||||||
|
raw/car/car084.jpg,0
|
||||||
|
raw/car/car087.jpg,0
|
||||||
|
raw/car/car089.jpg,0
|
||||||
|
raw/car/car099.jpg,0
|
||||||
|
raw/car/car103.jpg,0
|
||||||
|
raw/car/car105.jpg,0
|
||||||
|
raw/car/car106.jpg,0
|
||||||
|
raw/car/car116.jpg,0
|
||||||
|
raw/car/car117.jpg,0
|
||||||
|
raw/car/car120.jpg,0
|
||||||
|
raw/car/car132.jpg,0
|
||||||
|
raw/car/car138.jpg,0
|
||||||
|
raw/car/car139.jpg,0
|
||||||
|
raw/car/car152.jpg,0
|
||||||
|
raw/car/car153.jpg,0
|
||||||
|
raw/car/car157.jpg,0
|
||||||
|
raw/car/car168.jpg,0
|
||||||
|
raw/car/car177.jpg,0
|
||||||
|
raw/car/car182.jpg,0
|
||||||
|
raw/car/car183.jpg,0
|
||||||
|
raw/car/car184.jpg,0
|
||||||
|
raw/car/car187.jpg,0
|
||||||
|
raw/car/car192.jpg,0
|
||||||
|
raw/car/car209.jpg,0
|
||||||
|
raw/car/car212.jpg,0
|
||||||
|
raw/car/car215.jpg,0
|
||||||
|
raw/car/car222.jpg,0
|
||||||
|
raw/car/car225.jpg,0
|
||||||
|
raw/car/car227.jpg,0
|
||||||
|
raw/car/car237.jpg,0
|
||||||
|
raw/car/car238.jpg,0
|
||||||
|
raw/car/car249.jpg,0
|
||||||
|
raw/car/car250.jpg,0
|
||||||
|
raw/car/car257.jpg,0
|
||||||
|
raw/car/car263.jpg,0
|
||||||
|
raw/car/car275.jpg,0
|
||||||
|
raw/car/car279.jpg,0
|
||||||
|
raw/car/car283.jpg,0
|
||||||
|
raw/car/car288.jpg,0
|
||||||
|
raw/car/car299.jpg,0
|
||||||
|
raw/car/car300.jpg,0
|
||||||
|
raw/car/car317.jpg,0
|
||||||
|
raw/car/car318.jpg,0
|
||||||
|
raw/car/car336.jpg,0
|
||||||
|
raw/car/car345.jpg,0
|
||||||
|
raw/car/car351.jpg,0
|
||||||
|
raw/car/car357.jpg,0
|
||||||
|
raw/car/car358.jpg,0
|
||||||
|
raw/car/car360.jpg,0
|
||||||
|
raw/car/car369.jpg,0
|
||||||
|
raw/car/car374.jpg,0
|
||||||
|
raw/car/car376.jpg,0
|
||||||
|
raw/car/car377.jpg,0
|
||||||
|
raw/car/car379.jpg,0
|
||||||
|
raw/car/car380.jpg,0
|
||||||
|
raw/car/car381.jpg,0
|
||||||
|
raw/car/car386.jpg,0
|
||||||
|
raw/car/car396.jpg,0
|
||||||
|
raw/car/car402.jpg,0
|
||||||
|
raw/car/car404.jpg,0
|
||||||
|
raw/car/car410.jpg,0
|
||||||
|
raw/car/car424.jpg,0
|
||||||
|
raw/car/car437.jpg,0
|
||||||
|
raw/car/car439.jpg,0
|
||||||
|
raw/car/car441.jpg,0
|
||||||
|
raw/car/car454.jpg,0
|
||||||
|
raw/car/car457.jpg,0
|
||||||
|
raw/car/car458.jpg,0
|
||||||
|
raw/car/car460.jpg,0
|
||||||
|
raw/car/car461.jpg,0
|
||||||
|
raw/car/car470.jpg,0
|
||||||
|
raw/car/car475.jpg,0
|
||||||
|
raw/car/car477.jpg,0
|
||||||
|
raw/car/car486.jpg,0
|
||||||
|
raw/car/car490.jpg,0
|
||||||
|
raw/car/car495.jpg,0
|
||||||
|
raw/car/car500.jpg,0
|
||||||
|
raw/car/car502.jpg,0
|
||||||
|
raw/car/car511.jpg,0
|
||||||
|
raw/car/car525.jpg,0
|
||||||
|
raw/car/car534.jpg,0
|
||||||
|
raw/car/car537.jpg,0
|
||||||
|
raw/car/car544.jpg,0
|
||||||
|
raw/car/car546.jpg,0
|
||||||
|
raw/car/car547.jpg,0
|
||||||
|
raw/car/car551.jpg,0
|
||||||
|
raw/car/car559.jpg,0
|
||||||
|
raw/car/car566.jpg,0
|
||||||
|
raw/car/car568.jpg,0
|
||||||
|
raw/car/car570.jpg,0
|
||||||
|
raw/car/car571.jpg,0
|
||||||
|
raw/car/car574.jpg,0
|
||||||
|
raw/car/car577.jpg,0
|
||||||
|
raw/car/car580.jpg,0
|
||||||
|
raw/car/car583.jpg,0
|
||||||
|
raw/car/car585.jpg,0
|
||||||
|
raw/car/car588.jpg,0
|
||||||
|
raw/car/car600.jpg,0
|
||||||
|
raw/car/car604.jpg,0
|
||||||
|
raw/car/car606.jpg,0
|
||||||
|
raw/car/car611.jpg,0
|
||||||
|
raw/car/car613.jpg,0
|
||||||
|
raw/car/car625.jpg,0
|
||||||
|
raw/car/car626.jpg,0
|
||||||
|
raw/car/car638.jpg,0
|
||||||
|
raw/car/car646.jpg,0
|
||||||
|
raw/car/car647.jpg,0
|
||||||
|
raw/car/car649.jpg,0
|
||||||
|
raw/car/car653.jpg,0
|
||||||
|
raw/car/car661.jpg,0
|
||||||
|
raw/car/car664.jpg,0
|
||||||
|
raw/car/car667.jpg,0
|
||||||
|
raw/car/car669.jpg,0
|
||||||
|
raw/car/car670.jpg,0
|
||||||
|
raw/car/car691.jpg,0
|
||||||
|
raw/car/car698.jpg,0
|
||||||
|
raw/car/car701.jpg,0
|
||||||
|
raw/car/car707.jpg,0
|
||||||
|
raw/car/car715.jpg,0
|
||||||
|
raw/car/car716.jpg,0
|
||||||
|
raw/car/car718.jpg,0
|
||||||
|
raw/car/car720.jpg,0
|
||||||
|
raw/car/car728.jpg,0
|
||||||
|
raw/car/car730.jpg,0
|
||||||
|
raw/car/car733.jpg,0
|
||||||
|
raw/car/car741.jpg,0
|
||||||
|
raw/car/car743.jpg,0
|
||||||
|
raw/car/car753.jpg,0
|
||||||
|
raw/car/car755.jpg,0
|
||||||
|
raw/car/car756.jpg,0
|
||||||
|
raw/car/car757.jpg,0
|
||||||
|
raw/car/car760.jpg,0
|
||||||
|
raw/car/car761.jpg,0
|
||||||
|
raw/car/car763.jpg,0
|
||||||
|
raw/car/car764.jpg,0
|
||||||
|
raw/car/car768.jpg,0
|
||||||
|
raw/car/car769.jpg,0
|
||||||
|
raw/car/car770.jpg,0
|
||||||
|
raw/car/car772.jpg,0
|
||||||
|
raw/car/car774.jpg,0
|
||||||
|
raw/truck/truck001.jpg,2
|
||||||
|
raw/truck/truck006.jpg,2
|
||||||
|
raw/truck/truck009.jpg,2
|
||||||
|
raw/truck/truck011.jpg,2
|
||||||
|
raw/truck/truck018.jpg,2
|
||||||
|
raw/truck/truck020.jpg,2
|
||||||
|
raw/truck/truck021.jpg,2
|
||||||
|
raw/truck/truck026.jpg,2
|
||||||
|
raw/truck/truck031.jpg,2
|
||||||
|
raw/truck/truck039.jpg,2
|
||||||
|
raw/truck/truck043.jpg,2
|
||||||
|
raw/truck/truck045.jpg,2
|
||||||
|
raw/truck/truck051.jpg,2
|
||||||
|
raw/truck/truck067.jpg,2
|
||||||
|
raw/truck/truck075.jpg,2
|
||||||
|
raw/truck/truck080.jpg,2
|
||||||
|
raw/truck/truck084.jpg,2
|
||||||
|
raw/truck/truck088.jpg,2
|
||||||
|
raw/truck/truck091.jpg,2
|
||||||
|
raw/truck/truck093.jpg,2
|
||||||
|
raw/truck/truck095.jpg,2
|
||||||
|
raw/truck/truck097.jpg,2
|
||||||
|
raw/truck/truck098.jpg,2
|
||||||
|
raw/truck/truck103.jpg,2
|
||||||
|
raw/truck/truck107.jpg,2
|
||||||
|
raw/truck/truck113.jpg,2
|
||||||
|
raw/truck/truck116.jpg,2
|
||||||
|
raw/truck/truck117.jpg,2
|
||||||
|
raw/truck/truck118.jpg,2
|
||||||
|
raw/truck/truck124.jpg,2
|
||||||
|
raw/truck/truck130.jpg,2
|
||||||
|
raw/truck/truck136.jpg,2
|
||||||
|
raw/truck/truck141.jpg,2
|
||||||
|
raw/truck/truck146.jpg,2
|
||||||
|
raw/truck/truck152.jpg,2
|
||||||
|
raw/truck/truck153.jpg,2
|
||||||
|
raw/truck/truck155.jpg,2
|
||||||
|
raw/truck/truck157.jpg,2
|
||||||
|
raw/truck/truck164.jpg,2
|
||||||
|
raw/truck/truck170.jpg,2
|
||||||
|
raw/truck/truck171.jpg,2
|
||||||
|
raw/truck/truck176.jpg,2
|
||||||
|
raw/truck/truck185.jpg,2
|
||||||
|
raw/truck/truck192.jpg,2
|
||||||
|
raw/truck/truck193.jpg,2
|
||||||
|
raw/truck/truck197.jpg,2
|
||||||
|
raw/truck/truck207.jpg,2
|
||||||
|
raw/truck/truck211.jpg,2
|
||||||
|
raw/truck/truck216.jpg,2
|
||||||
|
raw/truck/truck217.jpg,2
|
||||||
|
raw/truck/truck218.jpg,2
|
||||||
|
raw/truck/truck220.jpg,2
|
||||||
|
raw/truck/truck221.jpg,2
|
||||||
|
raw/truck/truck223.jpg,2
|
||||||
|
raw/truck/truck226.jpg,2
|
||||||
|
raw/truck/truck235.jpg,2
|
||||||
|
raw/truck/truck252.jpg,2
|
||||||
|
raw/truck/truck259.jpg,2
|
||||||
|
raw/truck/truck261.jpg,2
|
||||||
|
raw/truck/truck264.jpg,2
|
||||||
|
raw/truck/truck271.jpg,2
|
||||||
|
raw/truck/truck306.jpg,2
|
||||||
|
raw/truck/truck309.jpg,2
|
||||||
|
raw/truck/truck311.jpg,2
|
||||||
|
raw/truck/truck317.jpg,2
|
||||||
|
raw/truck/truck326.jpg,2
|
||||||
|
raw/truck/truck328.jpg,2
|
||||||
|
raw/truck/truck329.jpg,2
|
||||||
|
raw/truck/truck333.jpg,2
|
||||||
|
raw/truck/truck335.jpg,2
|
||||||
|
raw/truck/truck345.jpg,2
|
||||||
|
raw/truck/truck360.jpg,2
|
|
1086
Lab4/dataset/Vehicles/train.csv
Normal file
1086
Lab4/dataset/Vehicles/train.csv
Normal file
File diff suppressed because it is too large
Load Diff
1899
Lab4/卷积神经网络实验.ipynb
Normal file
1899
Lab4/卷积神经网络实验.ipynb
Normal file
File diff suppressed because one or more lines are too long
@ -2,8 +2,9 @@ black
|
|||||||
ipdb
|
ipdb
|
||||||
jupyter
|
jupyter
|
||||||
numpy
|
numpy
|
||||||
torch==2.1.0
|
torch
|
||||||
torchaudio==2.1.0
|
torchaudio
|
||||||
torchvision==0.16.0
|
torchvision
|
||||||
tqdm
|
tqdm
|
||||||
matplotlib
|
matplotlib
|
||||||
|
pandas
|
Loading…
x
Reference in New Issue
Block a user