Raniahossam33 commited on
Commit
ffff548
·
verified ·
1 Parent(s): 5e64b46

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +68 -3
README.md CHANGED
@@ -1,3 +1,68 @@
1
- ---
2
- license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # YOLO Model Training and Inference
2
+
3
+ This README provides instructions for using the YOLO (You Only Look Once) model for object detection tasks using the Ultralytics library. The guide covers both training and inference processes.
4
+
5
+ ## Installation
6
+
7
+ First, install the required library:
8
+
9
+ ```
10
+ pip install ultralytics
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ### Importing the YOLO model
16
+
17
+ ```python
18
+ from ultralytics import YOLO
19
+ ```
20
+
21
+ ### Loading a pre-trained model
22
+
23
+ ```python
24
+ # Load a pre-trained model
25
+ model = YOLO('yolov8n.pt')
26
+ ```
27
+
28
+ Replace `'yolov8n.pt'` with the path to your desired model weights.
29
+
30
+ ### Training the model
31
+
32
+ To train the model on your custom dataset:
33
+
34
+ ```python
35
+ # Train the model
36
+ results = model.train(
37
+ data='path/to/your/data.yaml',
38
+ epochs=10,
39
+ imgsz=640,
40
+ device='mps'
41
+ )
42
+ ```
43
+
44
+ Parameters:
45
+ - `data`: Path to your dataset's YAML file
46
+ - `epochs`: Number of training epochs
47
+ - `imgsz`: Input image size
48
+ - `device`: Specify the device for training ('cuda' for NVIDIA GPU, 'mps' for Apple Silicon, 'cpu' for CPU)
49
+
50
+ ### Performing Inference
51
+
52
+ To perform inference on an image or video:
53
+
54
+ ```python
55
+ # Perform inference
56
+ results = model('path/to/your/image.jpg')
57
+
58
+ # Display results
59
+ results.show()
60
+ ```
61
+
62
+ ## Additional Notes
63
+
64
+ - Ensure your `data.yaml` file is correctly formatted and points to your training and validation datasets.
65
+ - Adjust the `epochs` and `imgsz` parameters based on your specific requirements and dataset characteristics.
66
+ - For multi-GPU training, you can use the `device` parameter to specify multiple GPUs, e.g., `device=[0,1]` for using GPUs 0 and 1.
67
+
68
+ For more detailed information and advanced usage, please refer to the [Ultralytics documentation](https://docs.ultralytics.com/).