Skip to main content

In this Project I am Using YoloV4 for object detection. To detect object using YoloV4 and OpenCv you have to write many lines of code, but using this framework you can do this using few lines of code.

Installation

pip install object_detector

Extract Images from a video

Import ExtractImages class from object_detector Library

>>> from object_detector import ExtractImages

Create a object ext of ExtractImages class

>>> ext = ExtractImages(path=0)

path=0 if you want to extract images from a video, write video path in place of 0.

or you can create object specifing Output path

>>> ext = ExtractImages(path=0,op=MyOutput)

By default Output path is Output

Start Extracting Images.

>>> ext.extract("A","B","C")

A, B, C are the path where extracting images collected. Relative path of "A" is MyOutput/A

Note: We are extracting Images in multiple path such that we can run our object detection task simultaneously.

Object Detection

Import ObjectDetector class from object_detector Library

>>> from object_detector import ObjectDetector

Create a object obj of class ObjectDetector

>>> obj = ObjectDetector(weights="cars.weights", cfg="yolov4-custom.cfg", classes=['licence'])

Object detection is done using YoLo. cars.weights is the trained file generated by training image dataset by darknet, and we are using yolov4-custom.cfg.

>>> img = obj.detect_object(path)

Write path of the image, from which you want to detect object. img is numpy array of image. To the image from numpy array write

>>> import cv2
>>> cv2.imshow("Image_Name",img)

or You can write

>>> import matplotlib.pyplot as plt
>>> plt.imshow(img)

If you want image without label write the code as

>>> img = obj.detect_object(path,label=False)

If you want to img only when obj is detected from image write the code as

>>> img = detect_object(path,detected_only=True)

To read text on the image add following code

>>> text = extract_text()

Show or Write objects from a video or camera

Import LiveDetect class and make a object of this class.

l = LiveDetect(weights="cars.weights", cfg="yolov4-custom.cfg", classes=['licence'])

Save images when object detect on video.

l.write_from_video(path="Traffic.mp4")

Show images when object detect on video.

l.show_from_video(path="Traffic.mp4")

Save images when object detect on the dir.

l.write_from_dir(path="Traffic.mp4")

Show images when object detect on the dir.

l.show_from_dir(path="Traffic.mp4")

Release files for object-detector 1.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for object-detector 1.9
File Size Uploaded
object_detector-1.9.tar.gz 4.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for object-detector 1.9
File Interpreter ABI Platform
object_detector-1.9-py3-none-any.whl Python 3 none any Details

Total release size: 10.0 kB

Release files / object_detector-1.9.tar.gz

Download URL object_detector-1.9.tar.gz
Size 4.7 kB
Tags Source
SHA-256 checksum
How to use checksums
2da728a9f07a2aae44b3ddaa41f75a77147011b7d54c8d855e04d05cbaaa7ebc
BLAKE2b-256 checksum
How to use checksums
407d6071028aa6269b764129906ff169f0d250ec97e4eb8ae25f0e1135e28091
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.26.0 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.7 CPython/3.10.4

Release files / object_detector-1.9-py3-none-any.whl

Download URL object_detector-1.9-py3-none-any.whl
Size 5.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b326dde6e31cedce6fb5590ffd8a9d3fdda099a9e40f17e286d5c5c2160ba6ea
BLAKE2b-256 checksum
How to use checksums
e01ef39356eb0a9f41631f4e60defdf7f2528d784b6b5043d93ffc4ecc1ae9d6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.26.0 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.7 CPython/3.10.4

Release history Release notifications | RSS feed

This release

1.9 This release

2 release files

1.8

2 release files

1.7

2 release files

1.6

2 release files

1.5

2 release files

1.4

2 release files

1.3

2 release files

1.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page