Skip to main content

Wider-Yolo Kütüphanesi ile Yüz Tespit Uygulamanı Yap

Project description

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:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wideryolo-0.0.8.tar.gz (3.4 kB view hashes)

Uploaded Source

Built Distribution

wideryolo-0.0.8-py3-none-any.whl (3.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page