nagasurendra commited on
Commit
3e7703e
·
verified ·
1 Parent(s): c5f5f5b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -3
app.py CHANGED
@@ -4,12 +4,21 @@ import os
4
  # Define the correct path to config.yaml (in the root directory)
5
  config_path = './config.yaml' # Adjust based on the actual path to your config.yaml
6
 
7
-
8
  # Load YOLO model
9
  model = YOLO("yolo11n.yaml") # You can choose a different model type like yolo5n, yolo6n, etc.
10
 
11
  # Train the model
12
  results = model.train(data=config_path, epochs=1)
13
- print("Model saved to:", 'runs/detect/train/weights/best.pt')
14
- model.save('path_to_save/best.pt')
15
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  # Define the correct path to config.yaml (in the root directory)
5
  config_path = './config.yaml' # Adjust based on the actual path to your config.yaml
6
 
 
7
  # Load YOLO model
8
  model = YOLO("yolo11n.yaml") # You can choose a different model type like yolo5n, yolo6n, etc.
9
 
10
  # Train the model
11
  results = model.train(data=config_path, epochs=1)
 
 
12
 
13
+ # Define the save directory
14
+ save_dir = './runs/detect/train/weights'
15
+
16
+ # Create directory if it doesn't exist
17
+ if not os.path.exists(save_dir):
18
+ os.makedirs(save_dir)
19
+
20
+ # Save the model
21
+ model.save(os.path.join(save_dir, 'best.pt'))
22
+
23
+ # Print confirmation
24
+ print("Model saved to:", os.path.join(save_dir, 'best.pt'))