Muhammad-Shahin-CS
commited on
Commit
·
bda7331
1
Parent(s):
423ea98
modified README.md
Browse files
README.md
CHANGED
|
@@ -16,17 +16,36 @@ yolo can be used for a variety of tasks and modes and accepts additional argumen
|
|
| 16 |
|
| 17 |
To use this model for object detection, follow these steps:
|
| 18 |
|
|
|
|
| 19 |
## Python
|
| 20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
```bash
|
| 22 |
pip install ultralytics
|
| 23 |
pip install opencv-python
|
| 24 |
|
| 25 |
import cv2
|
| 26 |
from ultralytics import YOLO
|
| 27 |
-
|
| 28 |
|
| 29 |
-
|
|
|
|
| 30 |
def detect_objects(model_path, image_path1, image_path2):
|
| 31 |
|
| 32 |
# Read images
|
|
@@ -47,22 +66,15 @@ def detect_objects(model_path, image_path1, image_path2):
|
|
| 47 |
result.show() # display to screen
|
| 48 |
result.save(filename="result.jpg") # save to disk
|
| 49 |
|
| 50 |
-
# Example usage
|
| 51 |
-
# file paths
|
| 52 |
model_path = 'YOLOv8\yolov8n.pt'
|
| 53 |
image_path1 = "path_to_your_image.jpg"
|
| 54 |
image_path2 = "path_to_your_image.jpg"
|
| 55 |
detect_objects(model_path, image_path1, image_path2)
|
| 56 |
-
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
-
Model Details
|
| 61 |
-
Model Name: YOLOv8n
|
| 62 |
-
Framework: PyTorch
|
| 63 |
-
Architecture: YOLOv8
|
| 64 |
-
|
| 65 |
-
|
| 66 |
@article{YOLOv8,
|
| 67 |
title={YOLOv8: Improved Object Detection with Enhanced Performance},
|
| 68 |
author={Muhammad Shahin},
|
|
|
|
| 16 |
|
| 17 |
To use this model for object detection, follow these steps:
|
| 18 |
|
| 19 |
+
|
| 20 |
## Python
|
| 21 |
+
```bash
|
| 22 |
+
from ultralytics import YOLO
|
| 23 |
+
|
| 24 |
+
# Load a model
|
| 25 |
+
model = YOLO("yolov8n.yaml") # build a new model from scratch
|
| 26 |
+
model = YOLO("yolov8n.pt") # load a pretrained model (recommended for training)
|
| 27 |
+
|
| 28 |
+
# Use the model
|
| 29 |
+
model.train(data="coco128.yaml", epochs=3) # train the model
|
| 30 |
+
metrics = model.val() # evaluate model performance on the validation set
|
| 31 |
+
results = model("https://ultralytics.com/images/bus.jpg") # predict on an image
|
| 32 |
+
path = model.export(format="onnx") # export the model to ONNX format
|
| 33 |
+
```
|
| 34 |
+
For more examples and detailed usage instructions, visit the [YOLOv8 Python Docs](https://docs.ultralytics.com/usage/python/).
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
## Python
|
| 38 |
+
Install the import necessary dependencies:
|
| 39 |
```bash
|
| 40 |
pip install ultralytics
|
| 41 |
pip install opencv-python
|
| 42 |
|
| 43 |
import cv2
|
| 44 |
from ultralytics import YOLO
|
| 45 |
+
```
|
| 46 |
|
| 47 |
+
code for performing object detection
|
| 48 |
+
```bash
|
| 49 |
def detect_objects(model_path, image_path1, image_path2):
|
| 50 |
|
| 51 |
# Read images
|
|
|
|
| 66 |
result.show() # display to screen
|
| 67 |
result.save(filename="result.jpg") # save to disk
|
| 68 |
|
| 69 |
+
# Example usage
|
|
|
|
| 70 |
model_path = 'YOLOv8\yolov8n.pt'
|
| 71 |
image_path1 = "path_to_your_image.jpg"
|
| 72 |
image_path2 = "path_to_your_image.jpg"
|
| 73 |
detect_objects(model_path, image_path1, image_path2)
|
| 74 |
+
```
|
| 75 |
|
| 76 |
|
| 77 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 78 |
@article{YOLOv8,
|
| 79 |
title={YOLOv8: Improved Object Detection with Enhanced Performance},
|
| 80 |
author={Muhammad Shahin},
|