diff options
| author | zhang <zch921005@126.com> | 2022-05-21 14:23:49 +0800 |
|---|---|---|
| committer | zhang <zch921005@126.com> | 2022-05-21 14:23:49 +0800 |
| commit | 678fab50280b647d95213a9695d07c49542696f2 (patch) | |
| tree | 74ca60de14311a8a2ff58dbf82d9b7574c9cd3ef /cv/seg/human_seg.py | |
| parent | 2180c68999eb8dc0c7bcec015b2703f5b8b20223 (diff) | |
0521
Diffstat (limited to 'cv/seg/human_seg.py')
| -rw-r--r-- | cv/seg/human_seg.py | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/cv/seg/human_seg.py b/cv/seg/human_seg.py new file mode 100644 index 0000000..106b5c7 --- /dev/null +++ b/cv/seg/human_seg.py @@ -0,0 +1,33 @@ +# 1、导入模块 +import os +import paddlehub as hub +import numpy as np +from collections import Counter +import cv2 +import matplotlib.pyplot as plt + + +path = './data/' +files = os.listdir(path) +imgs = [] + + +for i in files: + imgs.append(path + i) + +cv2.imshow('', cv2.imread(imgs[0])) + + + + +# 2、加载模型 +humanseg = hub.Module(name='deeplabv3p_xception65_humanseg') + + + +results = humanseg.segmentation(data={'image':imgs}, visualization=True) +unique, counts = np.unique(results[0]['data'], return_counts=True) +print(dict(zip(unique, counts))) + +print() + |
