File tree Expand file tree Collapse file tree
computer_vision_object_detection Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99
1010
1111class object_detection (object ):
12+ """Model encapsulation.
13+
14+ Parameters
15+ ----------
16+ model_name : str
17+ Choose the model to inference.
18+
19+ Methods
20+ ---------
21+ __init__()
22+ Initializing the model.
23+ __call__()
24+ (1)Formatted input and output. (2)Inference model.
25+ list()
26+ Abstract method. Return available a list of model_name.
27+
28+ Examples
29+ ---------
30+ Object Detection detection MSCOCO with YOLOv4, see `tutorial_object_detection_yolov4.py
31+ <https://github.com/tensorlayer/tensorlayer/blob/master/example/app_tutorials/tutorial_object_detection_yolov4.py>`__
32+ With TensorLayer
33+
34+ >>> # get the whole model
35+ >>> net = tl.app.computer_vision.object_detection('yolo4-mscoco')
36+ >>> # use for inferencing
37+ >>> output = net(img)
38+ """
1239
1340 def __init__ (self , model_name = 'yolo4-mscoco' ):
1441 self .model_name = model_name
Original file line number Diff line number Diff line change 11#! /usr/bin/python
22# -*- coding: utf-8 -*-
3- """YOLOv4 for MS COCO.
3+ """YOLOv4 for MS- COCO.
44
55# Reference:
66- [tensorflow-yolov4-tflite](
@@ -139,6 +139,29 @@ def cspdarknet53(input_data=None):
139139
140140
141141def YOLOv4 (NUM_CLASS , pretrained = False ):
142+ """Pre-trained YOLOv4 model.
143+
144+ Parameters
145+ ------------
146+ NUM_CLASS : int
147+ Number of classes in final prediction.
148+ pretrained : boolean
149+ Whether to load pretrained weights. Default False.
150+
151+ Examples
152+ ---------
153+ Object Detection with YOLOv4, see `computer_vision.py
154+ <https://github.com/tensorlayer/tensorlayer/blob/master/tensorlayer/app/computer_vision.py>`__
155+ With TensorLayer
156+
157+ >>> # get the whole model, without pre-trained YOLOv4 parameters
158+ >>> yolov4 = tl.app.YOLOv4(NUM_CLASS=80, pretrained=False)
159+ >>> # get the whole model, restore pre-trained YOLOv4 parameters
160+ >>> yolov4 = tl.app.YOLOv4(NUM_CLASS=80, pretrained=True)
161+ >>> # use for inferencing
162+ >>> output = yolov4(img, is_train=False)
163+
164+ """
142165
143166 input_layer = Input ([None , INPUT_SIZE , INPUT_SIZE , 3 ])
144167 route_1 , route_2 , conv = cspdarknet53 (input_layer )
You can’t perform that action at this time.
0 commit comments