From 678fab50280b647d95213a9695d07c49542696f2 Mon Sep 17 00:00:00 2001 From: zhang Date: Sat, 21 May 2022 14:23:49 +0800 Subject: 0521 --- cv/seg/human_seg.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 cv/seg/human_seg.py (limited to 'cv/seg/human_seg.py') 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() + -- cgit v1.2.3