Are you sure you want to delete this task? Once this task is deleted, it cannot be recovered.
|
2 years ago | |
---|---|---|
.idea | 2 years ago | |
__pycache__ | 2 years ago | |
algappspy_master | 2 years ago | |
detectionframework_master | 2 years ago | |
README.md | 2 years ago | |
detection.py | 2 years ago | |
img00663.jpg | 2 years ago | |
img00664.jpg | 2 years ago | |
requirements.txt | 2 years ago |
1.0
传入交通场景的图片,进行车辆的检测。
主要面向交通场景下的监控/电警图片,示例:
其他有明显车辆的图片亦可。
若图像中车辆过小(小于25*25个像素点),检测性能会受到影响。比如遥感、无人机或者高点俯拍的路口图片。
参考 requirement.txt
需注意pytorch的版本为 1.4.0
from detection import Detector
det = Detector()
res = det.run(image)
参数 | 类型 | 是否必填 | 说明 |
---|---|---|---|
image | PIL.Image.Image 或 ndarray | 是 | 维度为(H,W,C)的图片,通道类型为RGB, 图片长宽应大于50*50 |
若无检测到的车辆,返回空列表
若检测到车辆,返回元素为字典的列表,字典中每个元素代表一个检测框,其类型及含义如下表:
字段 | 类型 | 说明 |
---|---|---|
conf | float64 | 检测为车辆的置信度 |
box_top | int | 检测框左上角的x值 |
box_left | int | 检测狂右上角的y值 |
box_width | int | 检测框的宽度 |
box_height | int | 检测框的高度 |
from PIL import Image
from detection import Detector
det = Detector()
img = Image.open('img00664.jpg').convert("RGB")
res = det.run(img)
print(res)
# return of det.run()
[{'conf': 0.9197773337364197, 'box_top': 459, 'box_left': 34, 'box_width': 82, 'box_height': 91},
{'conf': 0.9191172122955322, 'box_top': 497, 'box_left': 237, 'box_width': 109, 'box_height': 122},
{'conf': 0.8987263441085815, 'box_top': 98, 'box_left': 154, 'box_width': 96, 'box_height': 72},
{'conf': 0.8986817598342896, 'box_top': 0, 'box_left': 232, 'box_width': 78, 'box_height': 107},
{'conf': 0.8876358866691589, 'box_top': 824, 'box_left': 78, 'box_width': 65, 'box_height': 46}]