Compare commits
No commits in common. "9d99b00e550e95bda9b08ba30a19b27d25603cde" and "8cd6df452702a1fc9520f244e947abcd85e49a0d" have entirely different histories.
9d99b00e55
...
8cd6df4527
1
.gitignore
vendored
@ -300,4 +300,3 @@ Temporary Items
|
||||
# project files
|
||||
/whl_packages/
|
||||
/federated_learning/runs/detect/*
|
||||
*.cache
|
||||
|
Before Width: | Height: | Size: 1.5 MiB After Width: | Height: | Size: 1.5 MiB |
BIN
federated_learning/test_data/client1/train/images/img1.jpg
Normal file
After Width: | Height: | Size: 225 B |
BIN
federated_learning/test_data/client1/train/images/img2.jpg
Normal file
After Width: | Height: | Size: 225 B |
BIN
federated_learning/test_data/client1/train/labels.cache
Normal file
@ -0,0 +1 @@
|
||||
0 0.5 0.5 0.2 0.2
|
@ -0,0 +1 @@
|
||||
1 0.3 0.3 0.4 0.4
|
BIN
federated_learning/test_data/client1/val/images/img1.jpg
Normal file
After Width: | Height: | Size: 225 B |
BIN
federated_learning/test_data/client1/val/images/img2.jpg
Normal file
After Width: | Height: | Size: 225 B |
BIN
federated_learning/test_data/client1/val/labels.cache
Normal file
1
federated_learning/test_data/client1/val/labels/img1.txt
Normal file
@ -0,0 +1 @@
|
||||
0 0.5 0.5 0.2 0.2
|
1
federated_learning/test_data/client1/val/labels/img2.txt
Normal file
@ -0,0 +1 @@
|
||||
1 0.3 0.3 0.4 0.4
|
BIN
federated_learning/test_data/client2/train/images/img1.jpg
Normal file
After Width: | Height: | Size: 225 B |
BIN
federated_learning/test_data/client2/train/images/img2.jpg
Normal file
After Width: | Height: | Size: 225 B |
BIN
federated_learning/test_data/client2/train/labels.cache
Normal file
@ -0,0 +1 @@
|
||||
0 0.5 0.5 0.2 0.2
|
@ -0,0 +1 @@
|
||||
1 0.3 0.3 0.4 0.4
|
BIN
federated_learning/test_data/client2/val/images/img1.jpg
Normal file
After Width: | Height: | Size: 225 B |
BIN
federated_learning/test_data/client2/val/images/img2.jpg
Normal file
After Width: | Height: | Size: 225 B |
BIN
federated_learning/test_data/client2/val/labels.cache
Normal file
1
federated_learning/test_data/client2/val/labels/img1.txt
Normal file
@ -0,0 +1 @@
|
||||
0 0.5 0.5 0.2 0.2
|
1
federated_learning/test_data/client2/val/labels/img2.txt
Normal file
@ -0,0 +1 @@
|
||||
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")
|
||||
global_model = YOLO("yolov8n.pt").to(device)
|
||||
# 设置类别数
|
||||
# global_model.model.nc = 2
|
||||
global_model.model.nc = 2
|
||||
|
||||
for _ in range(num_rounds):
|
||||
client_weights = []
|
||||
@ -96,7 +96,7 @@ def federated_train(num_rounds, clients_data):
|
||||
local_model.train(
|
||||
data=data_path,
|
||||
epochs=1, # 每轮本地训练1个epoch
|
||||
imgsz=640, # 图像大小
|
||||
imgsz=128, # 图像大小
|
||||
verbose=False # 关闭冗余输出
|
||||
)
|
||||
|
||||
|