Saravanan666/pypi-org huggingface dataset:
Package: yolo5face
Wrapper over YoloV5FaceA user-friendly Python wrapper for the YoloV5Face model, designed to simplify face detection in images. This wrapper offers straightforward functionalities for quick integration into Python projects, along with customization options for handling various face detection scenarios.InstallationInstall the YoloV5Face wrapper using pip to easily incorporate it into your projects:pipinstall-Uyolo5faceFace Detection: Standard and EnhancedThe YoloV5Face wrapper supports both standard and enhanced face detection. The standard detection is suitable for most use cases, while the enhanced detection, which aggregates results over multiple target sizes, is ideal for images with faces of varying sizes.Getting StartedTo detect faces in an image:fromyolo5face.get_modelimportget_model
importcv2# Initialize the modelmodel=get_model("yolov5n",device=-1,min_face=24)# Load your imageimage=cv2.imread(<IMAGE_PATH>)image=cv2.cvtColor(image,cv2.COLOR_BGR2RGB)# Standard Detectionboxes,key_points,scores=model(image,target_size=512)# Enhanced Detection (aggregating over multiple target sizes)enhanced_boxes,enhanced_key_points,enhanced_scores=model(image,target_size=[320,640,1280])Parameters:device: Set the processing device (cpu, cuda, mps, or CUDA device number).target_size: For standard detection, it's the minimum size of the target image. For enhanced detection, provide a list of sizes for better accuracy.min_face: Minimum size of faces to detect in pixels. Smaller faces will be ignored.This approach, especially the enhanced detection, uses multiple scales for improved accuracy and is followed by Non-Maximum Suppression to refine the results.LicenseThis YoloV5Face wrapper is released under theMIT License.
Package: yolo-auto
yolo_autoWhat is yolo_auto?A library that allows you to train custom yolv3 object detectors in one line!How does yolo_auto work?Syntax =x = Yolov3Train(Path to Labels, Path To images,number of classes, classnames in an array, Path to Working Directory, Subdivisions=8,batches-16, Image size=608)x.train()Sample:x = Yolov3Train("/Users/arjunpandey/Desktop/AI-Stuff/newlib/data/labels","/Users/arjunpandey/Desktop/AI-Stuff/newlib/data/images",classes,classnames,"/Users/arjunpandey/Desktop/AI-Stuff/newlib/")x.train()
Package: yoloface
YOLO FACEYouonlylookonce(YOLO)isastate-of-the-art,real-timeobjectdetectionsystem.ItisbasedonDeepLearning.
Facedetectionisoneoftheimportanttasksofobjectdetection.Weapplyasingleneuralnetworktothefullimage.
Thisprojectfocusesonimprovingtheaccuracyofdetectingthefaceusingthemodelofdeeplearningnetwork(YOLO).
Thisnetworkdividestheimageintoregionsandpredictsboundingboxesandprobabilitiesforeachregion.
Theseboundingboxesareweightedbythepredictedprobabilities.

Forthisproject,IamgoingtouseYOLOv3,oneofthemostfrequentlyusedversionsoftheYOLOfamily,whichcomprisesthestate-of-the-artobjectdetectionsystemforthereal-timescenarioanditisamazinglyaccurateandfast.
youcangivetheweightsfilecreatedbytrainingwithYOLOv3andourresultsonthecustomdataset.
Alsoithasbeenaddedconfigurationfilesforuseofweightsfileproperly.Youwanttotestourfacedetectionsystemyoucanusethefollowingsamplecodesample.User Installation :If you already have a working installation of numpy and pandas, opencv the easiest way to install yoloface is using pippipinstallyolofaceThis Package Depend On Other Packages:# Prerequisites1.numpy2.cv23.os4.PIL5.gdown6.time7.IPythonUsageFace Detection In Image# import librariesfromyolofaceimportface_analysisimportnumpyimportcv2face=face_analysis()#  Auto Download a large weight files from Google Drive.#  only first time.#  Automatically  create folder .yoloface on cwd.# example 1%%timeimg,box,conf=face.face_detection(image_path='path/to/jpg/or/png/filename.jpg',model='tiny')print(box)# box[i]=[x,y,w,h]print(conf)#  value between(0 - 1)  or probabilityface.show_output(img,box)# example 2%%timeimg,box,conf=face.face_detection(image_path='path/to/jpg/or/png/filename.jpg',model='full')print(box)print(conf)face.show_output(img,box)Real-Time Detection on a Webcamfromyolofaceimportface_analysisimportnumpyimportcv2# example 3cap=cv2.VideoCapture(0)whileTrue:_,frame=cap.read()_,box,conf=face.face_detection(frame_arr=frame,frame_status=True,model='tiny')output_frame=face.show_output(frame,box,frame_status=True)cv2.imshow('frame',output_frame)key=cv2.waitKey(1)ifkey==ord('v'):breakcap.release()cv2.destroyAllWindows()#press v (exits)# example 4cap=cv2.VideoCapture(r'video file path.mp4')whileTrue:_,frame=cap.read()__,box,conf=face.face_detection(frame_arr=frame,frame_status=True,model='full')output_frame=face.show_output(img=frame,face_box=box,frame_status=True)print(box)cv2.imshow('frame',output_frame)key=cv2.waitKey(0)ifkey==ord('v'):breakcap.release()cv2.destroyAllWindows()#press v (exits)Sample imagesOutput Image 1Output Image 2Output Image 3The YOLOv3 (You Only Look Once) is a state-of-the-art, real-time object detection algorithm. The published model recognizes 80 different objects in images and videos. For more details, you can refer to this paper.Reference linkGithub file source fistGithub file source secondChange Log0.0.3 (28/04/2021)First Release0.0.4 (29/04/2021)First Release
Package: yoloimport
# yoloimport*Never see another ImportError*Are you tired of seeing ImportErrors? **yoloimport** makes ImportErrors a relic of the past, by installing your dependencies for you whenever you import a missing package. Now you can focus on writing code instead of installing dependencies!## InstallationTo install, just run `pip install yoloimport` and kiss pip goodbye, because yoloimport will deal with pip for you!## ExampleLet's try to use the [itty framework](https://github.com/toastdriven/itty) for the first time!>>> from itty import get, run_ittyTraceback (most recent call last):File "<stdin>", line 1, in <module>ImportError: No module named ittyWho wants to see that nonsense!? Let's try it after importing **yoloimport**!>>> import yoloimport>>> from itty import get, run_ittyCollecting ittyUsing cached itty-0.8.2-py2.py3-none-any.whlInstalling collected packages: ittySuccessfully installed itty-0.8.2Collecting -winregCould not find any downloads that satisfy the requirement -winregNo distributions at all found for -winreg>>> @get('/')... def index(request):...     return 'Hello World!'...>>> run_itty()itty starting up (using wsgiref)...Listening on http://localhost:8080...Use Ctrl-C to quit.Who knows what that "-winreg" error was all about? I sure don't, but who cares? We got itty working without any pesky ImportErrors getting in our way!*Happy April 1st!*
Package: yoloimporter
yoloimporterimport directly from PyPIYOLO Importer is for those that like to live dangerously. For those that don't have
time to manage a local, reproducible, isolated, Python environment but instead
need their libraries NOW!YOLO Importer will resolve missing dependencies from the internet, and make them
immediately available to the current Python session, all through the import
system. When the current Python session is ended, these dependencies disappear,
leaving no trace of their use.Usageimportyoloimporter.doit# these do not need to be already-installed# this will work in any environment that has yoloimporter installedimportrequestsfromrichimportmarkdownfromrichimportconsoleout=console.Console()this_page=requests.get('https://raw.githubusercontent.com/ucodery/yoloimporter/master/README.md')out.print(markdown.Markdown(''.join(this_page.text)))InstallationYOLO Importer still needs to be installed before use, but nothing else you need will!
Try installing the latest version from pypi.orgpython-mpipinstallyoloimporter
Package: yolo-labeler
Automatic YOLO LabelerNote: Tool works for single object per image only. Please use images with single object for accurate results. You can verify labels by checking png images. If the background is correctly removed from image then it is labelled correctly.YOLO Labeler is a tool to remove images background and label object in YOLO format.ExamplesYOLO String: 0 0.513942 0.407692 0.272115 0.746795YOLO String: 0 0.287500 0.580769 0.575000 0.837821YOLO String: 1 0.546627 0.473380 0.899471 0.834987YOLO String: 2 0.312660 0.499840 0.625321 0.999679YOLO String: 2 0.484135 0.499840 0.363141 0.999679Installationpip3installyolo-labelerUsage as a libraryIntest.pyfromyolo_labelerimportyolo_labeleryolo_labeler.run(args)run commandpython3test.py--input_path/path/to/input/imageorimage_folder--output_image_path/path/to/output/images--output_text_path/path/to/output/text--yolo_labelclass_numAdvance usageTo not resize images provide --resize flag to 1python3test.py--input_path/path/to/input/imageorimage_folder--output_image_path/path/to/output/images--output_text_path/path/to/output/text--yolo_labelclass_num--size1To save output png images provide --png_pathpython3test.py--input_path/path/to/input/imageorimage_folder--output_image_path/path/to/output/images--output_text_path/path/to/output/text--yolo_labelclass_num--size1--png_path/path/to/output/pngTo resize images of custom width x height provide --width and --height. Default is 416x416python3test.py--input_path/path/to/input/imageorimage_folder--output_image_path/path/to/output/images--output_text_path/path/to/output/text--yolo_labelclass_num--png_path/path/to/output/png--width416--height416To change background behind object provide --background_imagepython3test.py--input_path/path/to/input/imageorimage_folder--output_image_path/path/to/output/images--output_text_path/path/to/output/text--yolo_labelclass_num--png_path/path/to/output/png--width1000--height1000--background_image/path/to/background/imageTo save changed background images provide --background_outpython3test.py--input_path/path/to/input/imageorimage_folder--output_image_path/path/to/output/images--output_text_path/path/to/output/text--yolo_labelclass_num--png_path/path/to/output/png--width416--height416--background_image/path/to/background/image--background_out/path/to/output/changed/background/imagesReferenceshttps://github.com/NathanUA/U-2-NetLicenseCopyright (c) 2020-presentAbhi PanchalLicensed underMIT License
Package: yolo-pyqt
Introductionyolo-pyqt provides an easy way to build automated quantitative trading systems for individual traders.The main features are:Simple API interface for querying and trading stocks and implementations for Futu and IB based onFutu Open APIandib_insyncInstallationpipinstallyolo-pyqtRequirements:Python 3.6 or higher;A running FutuOpenD application (version 5.9 or higher).A running TWS or IB Gateway application (version 1012 or higher).
As for the configuration, please locate to Configuration/API/Settings, Make sure:'Read-only API' is not checked.'Download open orders on connection' is checked.Set 'Socket port'Set 'Master API client ID'Examples:This is a complete script to get realtime prices for specified stock codes via IB API:frompyqt.api.impl.ib_apiimportIbAPIimporttimeib_api=IbAPI('127.0.0.1',7496,526)ib_api.start()for_inrange(5):data=ib_api.get_market_snapshot(['AAPL'])print('data=',data)time.sleep(1)ib_api.stop()Entire interface refers tointerface.
Package: yolor
Yolor-Pip: Packaged version of the Yolor repositoryOverviewThis repo is a packaged version of theYolormodel.BenchmarkModelTest SizeAPtestAP50testAP75testbatch1 throughputbatch32 inferenceYOLOR-CSP64052.8%71.2%57.6%106fps3.2msYOLOR-CSP-X64054.8%73.1%59.7%87fps5.5msYOLOR-P6128055.7%73.3%61.0%76fps8.3msYOLOR-W6128056.9%74.4%62.2%66fps10.7msYOLOR-E6128057.6%75.2%63.0%45fps17.1msYOLOR-D6128058.2%75.8%63.8%34fps21.8msYOLOv4-P589651.8%70.3%56.6%41fps(old)-YOLOv4-P6128054.5%72.6%59.8%30fps(old)-YOLOv4-P7153655.5%73.4%60.8%16fps(old)-Installationpip install yolorYolov6 Inferencefromyolor.helpersimportYolormodel=Yolor(cfg='yolor/cfg/yolor_p6.cfg',weights='yolor/yolor_p6.pt',imgsz=640,device='cuda:0')model.classes=Nonemodel.conf=0.25model.iou_=0.45model.show=Falsemodel.save=Truemodel.predict('yolor/data/highway.jpg')Citation@article{wang2021you,title={You Only Learn One Representation: Unified Network for Multiple Tasks},author={Wang, Chien-Yao and Yeh, I-Hau and Liao, Hong-Yuan Mark},journal={arXiv preprint arXiv:2105.04206},year={2021}}
Package: yolosplitter
yolo-splitterTool to create,modify YOLO dataset.InstallationpipinstallyolosplitterUsesfromyolosplitterimportYoloSplitterys=YoloSplitter(imgFormat=['.jpg','.jpeg','.png'],labelFormat=['.txt'])# If you have yolo-format dataset already on the systemdf=ys.from_yolo_dir(input_dir="yolo_dataset",ratio=(0.7,0.2,0.1),return_df=True)# If you have mixed Images and Labels in the same directorydf=ys.from_mixed_dir(input_dir="mydataset",ratio=(0.7,0.2,0.1),return_df=True)# To see train/test/val split size, total error files, all class names from annotation filesys.info()# !!! changed show_dataframe to get_dataframe()# to see dataframeys.get_dataframe()ys.save_split(output_dir="potholes")SavingNewsplitin'potholes'dir100%|██████████|118/118[00:00<00:00,1352.79it/s]# Use ys.show_show_errors  to show filename which have errorsys.show_errors()# Use ys.show_dataframe to see dataframe created on the datasetys.get_dataframe()# To see train/test/val split size, total error files, all class names from annotation filesys.info()Input DirectoryMyDataset/
├── 02.png
├── 02.txt
├── 03.png
├── 03.txt
├── 04.png
├── 04.txt
├── 05.png
├── 05.txt
├── 06.png
├── 06.txt
├── 07.png
├── 07.txt
├── 08.png
├── 08.txt
├── 09.png
├── 09.txt
├── 10.png
├── 10.txt
├── 11.png
└── 11.txtOutput DirectoryMyDataset-splitted/
├── data.yaml
├── train
│   ├── images
│   │   ├── 03.png
│   │   ├── 04.png
│   │   ├── 05.png
│   │   ├── 07.png
│   │   ├── 08.png
│   │   ├── 09.png
│   │   └── 10.png
│   └── labels
│       ├── 03.txt
│       ├── 04.txt
│       ├── 05.txt
│       ├── 07.txt
│       ├── 08.txt
│       ├── 09.txt
│       └── 10.txt
└── val
    ├── images
    │   ├── 02.png
    │   ├── 06.png
    │   └── 11.png
    └── labels
        ├── 02.txt
        ├── 06.txt
        └── 11.txtChange LogStable2023-01-30 version 4.9Fixed Fixes Annotation Parse Error. Thanks to [https://github.com/Xiteed]2023-12-20 version 4.8Changed yaml file style2023-12-19 version 4.7Fix output dir ofvaltovalidthanks to [https://github.com/AndreasFridh]Addedys.info()To see train/test/val split size, total error files, all class names from annotation filesChangedys.show_dataframetoys.get_dataframe()small bug fixes
Package: yolo-to-labelme
yolo2labelmeA python script for converting annotation format(yolo-txt to labelme-json).Installationpipinstallyolo-to-labelmeUsageArguments:--yolo: path to YOLO annotations directory.--labelme(optional): path to output directory.--width(optional): default value is 1024.--height(optional): default value is 1024.--classes: Path to the classes file(TXT format).--img_ext(optional): Default extention is "jpg".CLI Usage:Specify yolo-labels-directory, output directory(optional), classes file, image size(width, height)(optional), and image extention(optional).yolotolabelme--yolopath/to/yoloAnnotations--labelmepath/to/output--classespath/to/classes-fileUseful linksGithub code:https://github.com/adeel-maker/yolotolabelme/Yolo to labelme:https://pypi.org/project/yolo-to-labelme/Lableme to yolo :https://pypi.org/project/labelme2yolo/
Package: yolo-to-mongo
YOLO to MongoDB将 YOLO 格式的标注数据存入 MongoDB 数据库的小工具.快速使用pipinstallyolo-to-mongo
yolo-to-mongo使用示例:$yolo-to-mongo
欢迎使用YOLOtoMongoDB
开始导入任务(按Ctrl+C安全退出)>C:\Users\xxx\Desktop\测试数据\Post\20220210>127.0.0.1:27017
筛选目录下2614个文件...中的有效标注数据
文件遍历进度:100.0%[====================>]2614/2614eta[00:00]共筛选出1306个有效标注数据
处理待导入的1306个标注数据...(utf-8编码)数据处理进度:100.0%[====================>]1306/1306eta[00:00]完成1306个数据的处理,没有出现重复MD5码
导入1306个历史标注...到MongoDB数据库
数据导入进度:100.0%[====================>]1306/1306eta[00:00]成功导入0个数据,跳过1306个已存在数据
开始下一轮导入任务(按Ctrl+C安全退出)>安全退出
$本地开发开发过程中调试.python3-mvenvenv
pipinstall-rrequirements.txt发布之前的打包调试.pythonsetup.pycheck
pythonsetup.pysdist
pythonsetup.pyinstall测试数据将测试导入的数据放在demo/目录下.安装调试pipinstall-U-e.
yolo-to-mongo发布命令pipinstalltwine
pythonsetup.pysdist
twineuploaddist/yolo-to-mongo-x.x.tar.gz
Package: yolov3-tf
YOLOv3-TFYOLOv3 implementation in TensorFlow 2.xInstallationpip install yolov3-tfDepends on tensorflow >=2.3.0 <=2.9.1UsageThe package consists of three core modules -datasetmodelsutilsDatasetThedataset.pymodule is for loading and transforming the tfrecords for object detection. The examples in the input tfrecords must match the parsing schema.importyolov3_tf.datasetasdatasettrain_dataset=dataset.load_tfrecord_dataset(tfrecords_path)train_dataset=train_dataset.batch(batch_size)train_dataset=train_dataset.map(lambdax,y:(dataset.transform_images(x,image_dim),dataset.transform_targets(y,anchors,anchor_masks,image_dim),))ModelsThemodels.pymodule consists of implementation of two YOLOv3 and YOLOv3 tiny in Tesnsorflow.fromyolov3_tf.modelsimportYoloV3,YoloV3Tinymodel=YoloV3(image_dim=416,training=True,classes=10)UtilsTheutils.pymodule provides some common functions for training YOLOv3 model, viz., loading weights, freezing layers, drawing boxes on images, compute iou# convert weightsfromyolov3_tf.modelsimportYoloV3,YoloV3Tinyfromyolov3_tfimportutilsyolo=YoloV3()utils.load_darknet_weights(yolo,weights_path,is_tiny=False)yolo.save_weights(converted_weights_path)
Package: yolov4-cv
YOLOv4 darknet by OpenCV DNN.Install packagepip install yolov4-cvCode example:importnumpyasnpfromyolov4_cvimportYOLOv4_CVimportcv2# Just inherit YOLOv4_CV and define your class_names and class_colorsclassYOLOv4(YOLOv4_CV):# Define coco class namesclass_names=['person','bicycle','car','motorcycle','airplane','bus','train','truck','boat','traffic light','fire hydrant','stop sign','parking meter','bench','bird','cat','dog','horse','sheep','cow','elephant','bear','zebra','giraffe','backpack','umbrella','handbag','tie','suitcase','frisbee','skis','snowboard','sports ball','kite','baseball bat','baseball glove','skateboard','surfboard','tennis racket','bottle','wine glass','cup','fork','knife','spoon','bowl','banana','apple','sandwich','orange','broccoli','carrot','hot dog','pizza','donut','cake','chair','couch','potted plant','bed','dining table','toilet','tv','laptop','mouse','remote','keyboard','cell phone','microwave','oven','toaster','sink','refrigerator','book','clock','vase','scissors','teddy bear','hair drier','toothbrush']# Random to generate colorsclass_colors=[(int(i[0]),int(i[1]),int(i[2]))foriinnp.random.randint(256,size=(len(class_names),3))]# Simple camera readdefload_capture():capture=cv2.VideoCapture(1)capture.set(cv2.CAP_PROP_FRAME_WIDTH,1920)capture.set(cv2.CAP_PROP_FRAME_HEIGHT,1080)returncaptureif__name__=='__main__':# Load cameracapture=load_capture()# Load checkpoint from any path. (onnx only)model=YOLOv4('tests/yolov4-tiny.weights','tests/yolov4-tiny.cfg',(416,416))whileTrue:# Get camera framesuccess,frame=capture.read()ifnotsuccess:print('Open camera fail.')break# Inference all of output resultpreds=model(frame)forpredinpreds:print(pred.id,pred.name,pred.conf,pred.box)# Show labeled box resultmodel.show_label_boxes()# or you can get labeled box result# img = model.get_label_boxes_image()# Any key to quit.ifcv2.waitKey(1)>-1:print('finished by user')breakcapture.release()Demo example:
Package: yolov5-detect
YOLOv5 detect🚀simple yolov5 wrapper for detect(onnx, dnn, openvino)Installationpipinstallyolov5-detectExampleimportcv2frompathlibimportPathfromyolov5detectimportdetect,annotationoutput=Path("output dir")ifnotoutput.exists():output.mkdir()yolo=detect.YoloDetect("test.onnx","test.yaml",1000)names=yolo.get_names()root=Path("images dir")foriteminroot.rglob("*.jpg"):# detect all images and save label resultsimg=cv2.imread(str(item))det=yolo.detect(img.copy(),0.4)iflen(det)>0:annotator=annotation.Annotator(img.copy())for*xyxy,conf,clsindet:annotator.box_label(xyxy,f"{names[int(cls)]}{conf:.2f}")cv2.imwrite(annotator.result(),str(output/item.name))Referencehttps://github.com/ultralytics/yolov5https://github.com/mikel-brostrom/Yolov5_DeepSort_Pytorch
Package: yolov5-evaluator
yolov5-evaluatorWrapper for the detection program for ease of use yolov5.Installpip install yolov5-evaluatorUsefrom yolov5 import eval

result=eval.detectByPath('./inference/images/01.jpg','./weights/v5-2/last.pt',640)
print(result)


image=cv2.imread('./inference/images/01.jpg')
result=eval.detectByImg(image,'./weights/v5-2/last.pt',640)
print(result)paramseval.detectByPath(source,weight,imgsz)

eval.detectByImage(image,weight,imgsz)
Package: yolov5facedetector
Yolov5 Face DetectionDescriptionThe project is a wrap overyolov5-facerepo. Made simple portable interface for model import and inference. Model detects faces on images and returns bounding boxes and coordinates of 5 facial keypoints, which can be used for face alignment.Installationpipinstallyolov5facedetectorUsage examplefromyolov5facedetector.face_detectorimportYoloDetectorimportnumpyasnpfromPILimportImagemodel=YoloDetector(target_size=720,gpu=0,min_face=90)rgb_array_img=np.array(Image.open('test_image.jpg'))# Will make RGB Numpy Array Imagebboxes,confs,points=model.predict(rgb_array_img)You can also pass several images packed in a list to get multi-image predictions.bboxes,confs,points=model.predict([image1,image2])Other pretrained modelsCurrently Support YOLOv5 type n,m & l type of model fromyolov5-facerepo. Default model type is 'yolov5n' but you can change to m & l (larger model version) which is auto download when first time usedExample below:model=YoloFace(yolo_type='yolov5l',target_size=720)# Will download weight file automaticallybboxes,confs,points=model.predict(rgb_array_img)Result exampleCitiationThanks todeepcam-cnfor pretrained models andRebrikov Artemfor providing wrapper function of YOLOv5Face.
Package: yolov5-inference
Package dung de inference model yolov5 voi custom objectInstallpipinstallyolov5-inference==0.6Usefromyolov5_inference.inferimportDetectObjectclass_name={0:'text',1:'title',2:'list',3:'table',4:'figure'}model=DetectObject(weights='../path/of/weights',classes=class_name)img_path='../path/of/img'img=cv2.imread(img_path)rs=model.detect(img)# [x_min, y_min, x_max, y_max, cls]
Package: yolov5-onnx-cv
YOLOv5-ONNX read example by OpenCV DNN.If you wanna export to onnx format, please refer:https://github.com/ultralytics/yolov5Install packagepip install yolov5-onnx-cvCode example:importnumpyasnpfromyolov5_onnx_cvimportYOLOv5_ONNX_CVimportcv2# Just inherit YOLOv5_ONNX_CV and define your class_names and class_colorsclassYOLOv5(YOLOv5_ONNX_CV):# Define coco class namesclass_names=['person','bicycle','car','motorcycle','airplane','bus','train','truck','boat','traffic light','fire hydrant','stop sign','parking meter','bench','bird','cat','dog','horse','sheep','cow','elephant','bear','zebra','giraffe','backpack','umbrella','handbag','tie','suitcase','frisbee','skis','snowboard','sports ball','kite','baseball bat','baseball glove','skateboard','surfboard','tennis racket','bottle','wine glass','cup','fork','knife','spoon','bowl','banana','apple','sandwich','orange','broccoli','carrot','hot dog','pizza','donut','cake','chair','couch','potted plant','bed','dining table','toilet','tv','laptop','mouse','remote','keyboard','cell phone','microwave','oven','toaster','sink','refrigerator','book','clock','vase','scissors','teddy bear','hair drier','toothbrush']# Random to generate colorsclass_colors=[(int(i[0]),int(i[1]),int(i[2]))foriinnp.random.randint(256,size=(len(class_names),3))]# Simple camera readdefload_capture():capture=cv2.VideoCapture(1)capture.set(cv2.CAP_PROP_FRAME_WIDTH,1920)capture.set(cv2.CAP_PROP_FRAME_HEIGHT,1080)returncaptureif__name__=='__main__':# Load cameracapture=load_capture()# Load checkpoint from any path. (onnx only)model=YOLOv5('tests/yolov5s.onnx',(640,640),0.5)whileTrue:# Get camera framesuccess,frame=capture.read()ifnotsuccess:print('Open camera fail.')break# Inference all of output resultpreds=model(frame)forpredinpreds:print(pred.id,pred.name,pred.conf,pred.box)# Show labeled box resultmodel.show_label_boxes()# or you can get labeled box result# img = model.get_label_boxes_image()# Any key to quit.ifcv2.waitKey(1)>-1:print('finished by user')breakcapture.release()Demo example: