WIDER-YOLO : Yüz Tespit Uygulaması Yap
Wider-Yolo Kütüphanesinin Kullanımı
1. Wider Face Veri Setini İndir
Not: İndirilen veri setini ismini değiştirmeden wider_data klasörün içine atın.
2. Dosyaları Düzeni:
datasets/
wider_face_split/
- wider_face_train_bbx_gt.txt
- wider_face_val_bbx_gt.txt
WIDER_train/
- images
WIDER_train_annotations
WIDER_val
- images
WIDER_val_annotations
Not: WIDER_train_annotations ve WIDER_val_annotations klasörleri oluşturmanıza gerek yoktur.
3. Wider Veri Setini Voc Xml Formatına Çevir
python ./wider_to_xml.py -ap ./wider_data/wider_face_split/wider_face_train_bbx_gt.txt -tp ./wider_data/WIDER_train_annotations/ -ip ./wider_data/WIDER_train/images/
python ./wider_to_xml.py -ap ./wider_data/wider_face_split/wider_face_val_bbx_gt.txt -tp ./wider_data/WIDER_val_annotations/ -ip ./wider_data/WIDER_val/images/
4. Voc Xml Veri Setini Yolo Formatına Çevir
python ./xml_to_yolo --path ./wider_data/WIDER_train_annotations/
python ./xml_to_yolo --path ./wider_data/WIDER_val_annotations/
5. Yolo Modelini Eğit
!yolov5 train --data data.yaml --weights 'yolov5n.pt' --batch-size 16 --epochs 100 --imgs 512
6. Yolo Modelini Test Et
Tek resim test etmek için:
!yolov5 detect --weights wider-yolo.pth --source file.jpg
Tüm resim dosyasını test etmek için
!yolov5 detect --weights wider-yolo.pth --source path/*.jpg
Not: Yeterli Gpu kaynağına sahip olamadığım için wider seti için düşük parametre değerleri verdim. Parametre Değerleri:
batch-size: 256, epochs: 5, imgs 320
6. Yolov5 + Sahi Algoritmasını Test Et
from sahi.model import Yolov5DetectionModel
from sahi.utils.cv import read_image
from sahi.predict import get_prediction, get_sliced_prediction, predict
from IPython.display import Image
detection_model = Yolov5DetectionModel(
model_path="last.pt",
confidence_threshold=0.3,
device="cpu",
)
result = get_sliced_prediction(
"test_data/2.jpg",
detection_model,
slice_height = 256,
slice_width = 256,
overlap_height_ratio = 0.8,
overlap_width_ratio = 0.8
)
result.export_visuals(export_dir="demo_data/")
Image("demo_data/prediction_visual.png")
Sahi Algoritması ile ilgili Örnek Proje:
Referanslar:
Metadata
Release files for wideryolo 0.0.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| wideryolo-0.0.8.tar.gz | 3.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| wideryolo-0.0.8-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.2 kB
Release files / wideryolo-0.0.8.tar.gz
| Download URL | wideryolo-0.0.8.tar.gz |
|---|---|
| Size | 3.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ef97971dc74a3def78a1c09ed190f7ba0d4cc59d706b82e7558af3397000ec3d
|
|
BLAKE2b-256 checksum How to use checksums |
cb390036e6648f9968a5a730b28928b48dfed8ea6142c6492d024499b453210b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
|
Release files / wideryolo-0.0.8-py3-none-any.whl
| Download URL | wideryolo-0.0.8-py3-none-any.whl |
|---|---|
| Size | 3.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a4c2d4b49040c1b343df3c227bc242e4ddf77cc639b24f9c01226eb7b300cde6
|
|
BLAKE2b-256 checksum How to use checksums |
27dd82e4fe48bf96d4af3f624bd265bea4045ed7d461b2fb806a9424901a4ed1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
|