Compare commits
2 Commits
8cd6df4527
...
9d99b00e55
Author | SHA1 | Date | |
---|---|---|---|
9d99b00e55 | |||
dd0e0d869c |
1
.gitignore
vendored
@ -300,3 +300,4 @@ Temporary Items
|
|||||||
# project files
|
# project files
|
||||||
/whl_packages/
|
/whl_packages/
|
||||||
/federated_learning/runs/detect/*
|
/federated_learning/runs/detect/*
|
||||||
|
*.cache
|
||||||
|
Before Width: | Height: | Size: 1.5 MiB After Width: | Height: | Size: 1.5 MiB |
Before Width: | Height: | Size: 225 B |
Before Width: | Height: | Size: 225 B |
@ -1 +0,0 @@
|
|||||||
0 0.5 0.5 0.2 0.2
|
|
@ -1 +0,0 @@
|
|||||||
1 0.3 0.3 0.4 0.4
|
|
Before Width: | Height: | Size: 225 B |
Before Width: | Height: | Size: 225 B |
@ -1 +0,0 @@
|
|||||||
0 0.5 0.5 0.2 0.2
|
|
@ -1 +0,0 @@
|
|||||||
1 0.3 0.3 0.4 0.4
|
|
Before Width: | Height: | Size: 225 B |
Before Width: | Height: | Size: 225 B |
@ -1 +0,0 @@
|
|||||||
0 0.5 0.5 0.2 0.2
|
|
@ -1 +0,0 @@
|
|||||||
1 0.3 0.3 0.4 0.4
|
|
Before Width: | Height: | Size: 225 B |
Before Width: | Height: | Size: 225 B |
@ -1 +0,0 @@
|
|||||||
0 0.5 0.5 0.2 0.2
|
|
@ -1 +0,0 @@
|
|||||||
1 0.3 0.3 0.4 0.4
|
|
@ -71,7 +71,7 @@ def federated_train(num_rounds, clients_data):
|
|||||||
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
||||||
global_model = YOLO("yolov8n.pt").to(device)
|
global_model = YOLO("yolov8n.pt").to(device)
|
||||||
# 设置类别数
|
# 设置类别数
|
||||||
global_model.model.nc = 2
|
# global_model.model.nc = 2
|
||||||
|
|
||||||
for _ in range(num_rounds):
|
for _ in range(num_rounds):
|
||||||
client_weights = []
|
client_weights = []
|
||||||
@ -96,7 +96,7 @@ def federated_train(num_rounds, clients_data):
|
|||||||
local_model.train(
|
local_model.train(
|
||||||
data=data_path,
|
data=data_path,
|
||||||
epochs=1, # 每轮本地训练1个epoch
|
epochs=1, # 每轮本地训练1个epoch
|
||||||
imgsz=128, # 图像大小
|
imgsz=640, # 图像大小
|
||||||
verbose=False # 关闭冗余输出
|
verbose=False # 关闭冗余输出
|
||||||
)
|
)
|
||||||
|
|
||||||
|