Agmiyas commited on
Commit
4b4682a
1 Parent(s): 32aed8d

Adding usage on README

Browse files
Files changed (1) hide show
  1. README.md +18 -21
README.md CHANGED
@@ -23,31 +23,18 @@ Ensure you have Python 3.6 or later installed. Then install the required package
23
  pip install transformers torch torchvision
24
  ```
25
 
26
- ### Inference
27
 
28
- You can perform inference with the following code snippet:
29
  ```
30
- from transformers import Yolov5Model, Yolov5FeatureExtractor
 
31
 
32
- # Load model and feature extractor
33
- model_id = "armvectores/yolov5_handwritten_text_detection"
34
- feature_extractor = Yolov5FeatureExtractor.from_pretrained(model_id)
35
- model = Yolov5Model.from_pretrained(model_id)
36
 
37
- # Prepare your image (replace 'path/to/your/image.jpg' with your actual image path)
38
- image = Image.open('path/to/your/image.jpg')
39
-
40
- # Perform inference
41
- inputs = feature_extractor(images=image, return_tensors="pt")
42
- outputs = model(**inputs)
43
-
44
- # Analyze the outputs
45
- detections = outputs[0]
46
-
47
- # detections consist of [x_min, y_min, x_max, y_max, confidence, class]
48
- # Loop through detections and print results
49
- for detection in detections:
50
- print(f"Coordinates: {detection[:4]}, Confidence: {detection[4]}")
51
  ```
52
 
53
  ## Limitations
@@ -66,4 +53,14 @@ This description should provide users with an overview of the YOLOv5 model tailo
66
 
67
  <p align="center">
68
  <img width="200px" src="results.png" alt="qr"/>
 
 
 
 
 
 
 
 
 
 
69
  </p>
 
23
  pip install transformers torch torchvision
24
  ```
25
 
26
+ ### How to use
27
 
28
+ You can do the predictions with the following code snippet:
29
  ```
30
+ import ultralytics
31
+ from ultralytics import YOLO
32
 
33
+ # Load weights for YOLO
34
+ model = YOLO('best.pt')
 
 
35
 
36
+ # Do the predictions
37
+ model.predict(source="path_to_your_image", save=True, show=True, show_labels=False, show_conf=False, conf=0.3)
 
 
 
 
 
 
 
 
 
 
 
 
38
  ```
39
 
40
  ## Limitations
 
53
 
54
  <p align="center">
55
  <img width="200px" src="results.png" alt="qr"/>
56
+ </p>
57
+
58
+ ## Tests
59
+
60
+ <p align="center">
61
+ <img width="400px" src="prediction1.png" alt="qr"/>
62
+ </p>
63
+
64
+ <p align="center">
65
+ <img width="400px" src="prediction2.png" alt="qr"/>
66
  </p>