Skip to main content

A simple Wrapper for YOLOv7

Project description

An unofficial wrapper of the yolov7 project.

It is very simple, and has only one function: calculateDetections(). Currently it only supports images, on CPU.

Installation

pip install f

Usage

from f.Detector import Detector as det
from PIL import Image


def main():
    # Initialize the YOLO inference object
    detector = det(weights_path='yolov7.pt', conf_thres=0.7, iou_thres=0.45, img_size=640)

    # Load the image
    image = Image.open('test_images/test_4.jpg')

    download_path = 'test_images/test_4_result.jpg'  # Leave as None if not needed

    dets = detector.calculateDetections(image, view_img=True, download_path=download_path)

    print(dets)


if __name__ == '__main__':
    main()

This returns a list of dictionaries, each dictionary is formatted as follows:

{
    'class': 'person', 
    'confidence': 0.966009259223938, 
    'bbox': [31.0, 144.0, 469.0, 653.0]
}

where bbox is a list of [x1, y1, x2, y2] coordinates of the bounding box. With view_img=True, the image with bounding boxes will be displayed as such:

image

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

YOLOv7Detector-0.0.3.tar.gz (139.0 kB view details)

Uploaded Source

Built Distribution

YOLOv7Detector-0.0.3-py3-none-any.whl (152.3 kB view details)

Uploaded Python 3

File details

Details for the file YOLOv7Detector-0.0.3.tar.gz.

File metadata

  • Download URL: YOLOv7Detector-0.0.3.tar.gz
  • Upload date:
  • Size: 139.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for YOLOv7Detector-0.0.3.tar.gz
Algorithm Hash digest
SHA256 c98db07caef11c0cbd0d31df4e42fe3dcfa7d906da73c0f4a811167034bb4e8f
MD5 3b1bffaf87adc4fb5348cb29a246909c
BLAKE2b-256 2eac97b4ed7126ee9c157cc5a81842e5347d0c6e66f2bce1c4c98c976165ea95

See more details on using hashes here.

File details

Details for the file YOLOv7Detector-0.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for YOLOv7Detector-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 317e253673fa7e9c0c3818d629f1556defaafc520aa7b506e1de368f975e7a9a
MD5 c8f7c43e4fc1083b874a9d522ac87a1d
BLAKE2b-256 7487bcb47a5d245d17fcf01fe9f0d7271a16ea74411f782b20b5ba4e7c7b02cb

See more details on using hashes here.

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