main.py 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import warnings
  2. warnings.filterwarnings('ignore')
  3. from ultralytics import YOLO
  4. if __name__ == '__main__':
  5. # model = YOLO(model='yolov8n-seg.yaml')
  6. # # model.load('yolov8n.pt') # loading pretrain weights
  7. # model.train(data='vinno_dataset/Liver-Focal-Seg.yaml',
  8. # cache=False,
  9. # imgsz=320,
  10. # epochs=2,
  11. # batch=16,
  12. # close_mosaic=0,
  13. # workers=1,
  14. # device='0',
  15. # optimizer='SGD', # using SGD
  16. # # patience=0, # close earlystop
  17. # # resume='', # last.pt path
  18. # # amp=False, # close amp
  19. # # fraction=0.2,
  20. # project='runs/train',
  21. # name='exp',
  22. # )
  23. from ultralytics import RTDETR
  24. model = RTDETR("rt-detr/rtdetr-l.yaml")
  25. # Display model information (optional)
  26. model.info()
  27. # Train the model on the COCO8 example dataset for 100 epochs
  28. results = model.train(data='vinno_dataset/Thyroid-TIRADS-Obj.yaml',
  29. cache=False,
  30. imgsz=320,
  31. epochs=2,
  32. batch=4,
  33. close_mosaic=0,
  34. workers=1,
  35. device='0',
  36. optimizer='SGD', # using SGD
  37. # patience=0, # close earlystop
  38. # resume='', # last.pt path
  39. # amp=False, # close amp
  40. # fraction=0.2,
  41. project='runs/train',
  42. name='exp',)