Metadata-Version: 2.1
Name: YOLOv7Detector
Version: 0.0.3
Summary: A simple Wrapper for YOLOv7
Home-page: https://github.com/SSaoulis/YOLOv7Detector
Author: Stefan Saoulis
Author-email: stefan.sooley@gmail.com
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE.md
Requires-Dist: matplotlib>=3.2.2
Requires-Dist: numpy<1.24.0,>=1.18.5
Requires-Dist: opencv-python>=4.1.1
Requires-Dist: Pillow>=7.1.2
Requires-Dist: PyYAML>=5.3.1
Requires-Dist: requests>=2.23.0
Requires-Dist: scipy>=1.4.1
Requires-Dist: torch!=1.12.0,>=1.7.0
Requires-Dist: torchvision!=0.13.0,>=0.8.1
Requires-Dist: tqdm>=4.41.0
Requires-Dist: protobuf<4.21.3
Requires-Dist: tensorboard>=2.4.1
Requires-Dist: pandas>=1.1.4
Requires-Dist: seaborn>=0.11.0
Requires-Dist: ipython
Requires-Dist: psutil
Requires-Dist: thop

An unofficial wrapper of the [yolov7](https://github.com/WongKinYiu/yolov7.git) project.

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

## Installation

```bash
pip install f
```

## Usage

```python
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:
```python

{
    '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](test_images/test_4_result.jpg)
