File size: 1,047 Bytes
20a2f64 ee5107b b937123 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
---
license: apache-2.0
---
| ![Imagen](test_images/Shelf_image2.jpg) | ![Imagen2](test_images/Image1.png) |
| --- | --- |
- Install yolov5:
```bash
pip install yolov5==7.0.5
```
- Set image
```bash
wget -O 'image.jpg' 'https://images.unsplash.com/photo-1556767576-cf0a4a80e5b8?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxzZWFyY2h8NXx8c3VwZXJtYXJrZXQlMjBzaGVsdmVzfGVufDB8fDB8fHww&w=1000&q=80'
```
- Load model and perform prediction:
```python
import yolov5
# load model
model = yolov5.load('Jonathancasjar/Retail_Shelves')
# set model parameters
model.conf = 0.25 # NMS confidence threshold
# set an image
img = '/content/image.jpg'
# perform inference
results = model(img, size=640)
# inference with test time augmentation
results = model(img, augment=True)
# parse results
predictions = results.pred[0]
boxes = predictions[:, :4] # x1, y1, x2, y2
scores = predictions[:, 4]
categories = predictions[:, 5]
# show detection bounding boxes on image
results.show()
# save results into "results/" folder
results.save(save_dir='results/')
```
|