Referentie voor ultralytics/utils/autobatch.py
Opmerking
Dit bestand is beschikbaar op https://github.com/ultralytics/ ultralytics/blob/main/ ultralytics/utils/autobatch .py. Als je een probleem ziet, help het dan oplossen door een Pull Request 🛠️ bij te dragen. Bedankt 🙏!
ultralytics.utils.autobatch.check_train_batch_size(model, imgsz=640, amp=True)
Controleer YOLO trainingsbatchgrootte met de functie autobatch().
Parameters:
Naam | Type | Beschrijving | Standaard |
---|---|---|---|
model |
Module
|
YOLO model om de partijgrootte voor te controleren. |
vereist |
imgsz |
int
|
Beeldgrootte gebruikt voor training. |
640
|
amp |
bool
|
Als dit waar is, gebruik dan automatische gemengde precisie (AMP) voor training. |
True
|
Retourneert:
Type | Beschrijving |
---|---|
int
|
Optimale batchgrootte berekend met de functie autobatch(). |
Broncode in ultralytics/utils/autobatch.py
ultralytics.utils.autobatch.autobatch(model, imgsz=640, fraction=0.6, batch_size=DEFAULT_CFG.batch)
Schat automatisch de beste YOLO batchgrootte in om een fractie van het beschikbare CUDA-geheugen te gebruiken.
Parameters:
Naam | Type | Beschrijving | Standaard |
---|---|---|---|
model |
module
|
YOLO model om de partijgrootte voor te berekenen. |
vereist |
imgsz |
int
|
De afbeeldingsgrootte die wordt gebruikt als invoer voor het YOLO model. Standaard 640. |
640
|
fraction |
float
|
De fractie van het beschikbare CUDA-geheugen om te gebruiken. Staat standaard op 0,60. |
0.6
|
batch_size |
int
|
De standaard batchgrootte die wordt gebruikt als er een fout wordt gedetecteerd. Standaard 16. |
batch
|
Retourneert:
Type | Beschrijving |
---|---|
int
|
De optimale batchgrootte. |