|
19 | 19 | * [Available Models](#available-models) |
20 | 20 | * [Object Detection](#object-detection) |
21 | 21 | * [Plate Detection](#plate-detection) |
| 22 | + * [Installation](#installation) |
22 | 23 | * [Contributing](#contributing) |
23 | 24 | <!-- TOC --> |
24 | 25 |
|
@@ -58,6 +59,48 @@ deployment. |
58 | 59 | _<sup>[1]</sup> Inference on Mac M1 chip using CPUExecutionProvider. Utilizing CoreMLExecutionProvider accelerates speed |
59 | 60 | by 5x._ |
60 | 61 |
|
| 62 | +<details> |
| 63 | + <summary>Usage</summary> |
| 64 | + |
| 65 | + ```python |
| 66 | +import cv2 |
| 67 | +from rich import print |
| 68 | + |
| 69 | +from open_image_models import LicensePlateDetector |
| 70 | + |
| 71 | +# Initialize the License Plate Detector with the pre-trained YOLOv9 model |
| 72 | +lp_detector = LicensePlateDetector(detection_model="yolo-v9-t-384-license-plate-end2end") |
| 73 | + |
| 74 | +# Load an image |
| 75 | +image_path = "path/to/license_plate_image.jpg" |
| 76 | +image = cv2.imread(image_path) |
| 77 | + |
| 78 | +# Perform license plate detection |
| 79 | +detections = lp_detector.predict(image) |
| 80 | +print(detections) |
| 81 | + |
| 82 | +# Benchmark the model performance |
| 83 | +lp_detector.show_benchmark(num_runs=1000) |
| 84 | + |
| 85 | +# Display predictions on the image |
| 86 | +annotated_image = lp_detector.display_predictions(image) |
| 87 | + |
| 88 | +# Show the annotated image |
| 89 | +cv2.imshow("Annotated Image", annotated_image) |
| 90 | +cv2.waitKey(0) |
| 91 | +cv2.destroyAllWindows() |
| 92 | + ``` |
| 93 | + |
| 94 | +</details> |
| 95 | + |
| 96 | +### Installation |
| 97 | + |
| 98 | +To install open-image-models via pip, use the following command: |
| 99 | + |
| 100 | +```shell |
| 101 | +pip install open-image-models |
| 102 | +``` |
| 103 | + |
61 | 104 | ### Contributing |
62 | 105 |
|
63 | 106 | Contributions to the repo are greatly appreciated. Whether it's bug fixes, feature enhancements, or new models, |
|
0 commit comments