!unzip 95.zip -d source
Archive: 95.zip
inflating: source/1.jpg
inflating: source/10.jpg
inflating: source/11.jpg
inflating: source/12.jpg
inflating: source/13.jpg
inflating: source/14.jpg
inflating: source/15.jpg
inflating: source/16.jpg
inflating: source/17.jpg
inflating: source/18.jpg
inflating: source/19.jpg
inflating: source/2.jpg
inflating: source/20.jpg
inflating: source/21.jpg
inflating: source/22.jpg
inflating: source/23.jpg
inflating: source/24.jpg
inflating: source/25.jpg
inflating: source/26.jpg
inflating: source/27.jpg
inflating: source/28.jpg
inflating: source/29.jpg
inflating: source/3.jpg
inflating: source/30.jpg
inflating: source/31.jpg
inflating: source/32.jpg
inflating: source/33.jpg
inflating: source/34.jpg
inflating: source/35.jpg
inflating: source/36.jpg
inflating: source/37.jpg
inflating: source/38.jpg
inflating: source/39.jpg
inflating: source/4.jpg
inflating: source/40.jpg
inflating: source/41.jpg
inflating: source/42.jpg
inflating: source/43.jpg
inflating: source/44.jpg
inflating: source/45.jpg
inflating: source/46.jpg
inflating: source/47.jpg
inflating: source/48.jpg
inflating: source/49.jpg
inflating: source/5.jpg
inflating: source/50.jpg
inflating: source/51.jpg
inflating: source/52.jpg
inflating: source/53.jpg
inflating: source/54.jpg
inflating: source/55.jpg
inflating: source/56.jpg
inflating: source/57.jpg
inflating: source/58.jpg
inflating: source/59.jpg
inflating: source/6.jpg
inflating: source/60.jpg
inflating: source/61.jpg
inflating: source/62.jpg
inflating: source/63.jpg
inflating: source/64.jpg
inflating: source/65.jpg
inflating: source/66.jpg
inflating: source/67.jpg
inflating: source/68.jpg
inflating: source/69.jpg
inflating: source/7.jpg
inflating: source/70.jpg
inflating: source/71.jpg
inflating: source/72.jpg
inflating: source/73.jpg
inflating: source/74.jpg
inflating: source/75.jpg
inflating: source/76.jpg
inflating: source/77.jpg
inflating: source/78.jpg
inflating: source/79.jpg
inflating: source/8.jpg
inflating: source/80.jpg
inflating: source/81.jpg
inflating: source/82.jpg
inflating: source/83.jpg
inflating: source/84.jpg
inflating: source/85.jpg
inflating: source/86.jpg
inflating: source/87.jpg
inflating: source/88.jpg
inflating: source/89.jpg
inflating: source/9.jpg
inflating: source/90.jpg
inflating: source/91.jpg
inflating: source/92.jpg
inflating: source/93.jpg
inflating: source/94.jpg
inflating: source/95.jpg
import paddlehub as hub
! hub install deeplabv3p_xception65_humanseg
/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/sklearn/externals/joblib/externals/cloudpickle/cloudpickle.py:47: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
import imp
2020-04-28 13:04:32,988-INFO: font search path ['/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/matplotlib/mpl-data/fonts/ttf', '/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/matplotlib/mpl-data/fonts/afm', '/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/matplotlib/mpl-data/fonts/pdfcorefonts']
2020-04-28 13:04:33,369-INFO: generated new fontManager
Downloading deeplabv3p_xception65_humanseg
[==================================================] 100.00%
Uncompress /home/aistudio/.paddlehub/tmp/tmpv0mv7zcw/deeplabv3p_xception65_humanseg
[==================================================] 100.00%
Successfully installed deeplabv3p_xception65_humanseg-1.0.0
humanseg = hub.Module(name="deeplabv3p_xception65_humanseg")
[32m[2020-04-28 13:04:56,467] [ INFO] - Installing deeplabv3p_xception65_humanseg module[0m
[32m[2020-04-28 13:04:56,485] [ INFO] - Module deeplabv3p_xception65_humanseg already installed in /home/aistudio/.paddlehub/modules/deeplabv3p_xception65_humanseg[0m
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import os
# path = ['work/test.jpeg','work/yushuxin.jpg']
# results = humanseg.segmentation(data={"image":path})
file_path_list=[]
for root, dirs, files in os.walk("source", topdown=False):
for name in files:
# print(os.path.join(root, name))
file_path=os.path.join(root, name)
file_path_list.append(file_path)
print(file_path_list)
results = humanseg.segmentation(data={"image":file_path_list})
['source/46.jpg', 'source/48.jpg', 'source/4.jpg', 'source/21.jpg', 'source/51.jpg', 'source/81.jpg', 'source/26.jpg', 'source/54.jpg', 'source/75.jpg', 'source/17.jpg', 'source/47.jpg', 'source/68.jpg', 'source/92.jpg', 'source/72.jpg', 'source/2.jpg', 'source/84.jpg', 'source/87.jpg', 'source/35.jpg', 'source/11.jpg', 'source/31.jpg', 'source/14.jpg', 'source/9.jpg', 'source/16.jpg', 'source/70.jpg', 'source/8.jpg', 'source/43.jpg', 'source/45.jpg', 'source/71.jpg', 'source/22.jpg', 'source/58.jpg', 'source/86.jpg', 'source/5.jpg', 'source/44.jpg', 'source/12.jpg', 'source/38.jpg', 'source/42.jpg', 'source/90.jpg', 'source/20.jpg', 'source/82.jpg', 'source/83.jpg', 'source/32.jpg', 'source/36.jpg', 'source/1.jpg', 'source/18.jpg', 'source/65.jpg', 'source/89.jpg', 'source/63.jpg', 'source/37.jpg', 'source/28.jpg', 'source/60.jpg', 'source/88.jpg', 'source/56.jpg', 'source/49.jpg', 'source/53.jpg', 'source/94.jpg', 'source/39.jpg', 'source/10.jpg', 'source/19.jpg', 'source/33.jpg', 'source/64.jpg', 'source/59.jpg', 'source/7.jpg', 'source/30.jpg', 'source/24.jpg', 'source/79.jpg', 'source/73.jpg', 'source/41.jpg', 'source/61.jpg', 'source/91.jpg', 'source/40.jpg', 'source/77.jpg', 'source/80.jpg', 'source/62.jpg', 'source/52.jpg', 'source/13.jpg', 'source/55.jpg', 'source/93.jpg', 'source/34.jpg', 'source/15.jpg', 'source/50.jpg', 'source/27.jpg', 'source/66.jpg', 'source/23.jpg', 'source/29.jpg', 'source/69.jpg', 'source/25.jpg', 'source/57.jpg', 'source/78.jpg', 'source/95.jpg', 'source/76.jpg', 'source/3.jpg', 'source/85.jpg', 'source/6.jpg', 'source/74.jpg', 'source/67.jpg']
# 预测结果展示
print(results)
for i in results:
test_img_path = i['processed']
img = mpimg.imread(test_img_path)
# 展示预测结果图片
plt.figure(figsize=(10,10))
plt.imshow(img)
plt.axis('off')
w(img)
plt.axis('off')
plt.show()
[{'origin': 'source/46.jpg', 'processed': 'humanseg_output/46.png'}, {'origin': 'source/48.jpg', 'processed': 'humanseg_output/48.png'}, {'origin': 'source/4.jpg', 'processed': 'humanseg_output/4.png'}, {'origin': 'source/21.jpg', 'processed': 'humanseg_output/21.png'}, {'origin': 'source/51.jpg', 'processed': 'humanseg_output/51.png'}, {'origin': 'source/81.jpg', 'processed': 'humanseg_output/81.png'}, {'origin': 'source/26.jpg', 'processed': 'humanseg_output/26.png'}, {'origin': 'source/54.jpg', 'processed': 'humanseg_output/54.png'}, {'origin': 'source/75.jpg', 'processed': 'humanseg_output/75.png'}, {'origin': 'source/17.jpg', 'processed': 'humanseg_output/17.png'}, {'origin': 'source/47.jpg', 'processed': 'humanseg_output/47.png'}, {'origin': 'source/68.jpg', 'processed': 'humanseg_output/68.png'}, {'origin': 'source/92.jpg', 'processed': 'humanseg_output/92.png'}, {'origin': 'source/72.jpg', 'processed': 'humanseg_output/72.png'}, {'origin': 'source/2.jpg', 'processed': 'humanseg_output/2.png'}, {'origin': 'source/84.jpg', 'processed': 'humanseg_output/84.png'}, {'origin': 'source/87.jpg', 'processed': 'humanseg_output/87.png'}, {'origin': 'source/35.jpg', 'processed': 'humanseg_output/35.png'}, {'origin': 'source/11.jpg', 'processed': 'humanseg_output/11.png'}, {'origin': 'source/31.jpg', 'processed': 'humanseg_output/31.png'}, {'origin': 'source/14.jpg', 'processed': 'humanseg_output/14.png'}, {'origin': 'source/9.jpg', 'processed': 'humanseg_output/9.png'}, {'origin': 'source/16.jpg', 'processed': 'humanseg_output/16.png'}, {'origin': 'source/70.jpg', 'processed': 'humanseg_output/70.png'}, {'origin': 'source/8.jpg', 'processed': 'humanseg_output/8.png'}, {'origin': 'source/43.jpg', 'processed': 'humanseg_output/43.png'}, {'origin': 'source/45.jpg', 'processed': 'humanseg_output/45.png'}, {'origin': 'source/71.jpg', 'processed': 'humanseg_output/71.png'}, {'origin': 'source/22.jpg', 'processed': 'humanseg_output/22.png'}, {'origin': 'source/58.jpg', 'processed': 'humanseg_output/58.png'}, {'origin': 'source/86.jpg', 'processed': 'humanseg_output/86.png'}, {'origin': 'source/5.jpg', 'processed': 'humanseg_output/5.png'}, {'origin': 'source/44.jpg', 'processed': 'humanseg_output/44.png'}, {'origin': 'source/12.jpg', 'processed': 'humanseg_output/12.png'}, {'origin': 'source/38.jpg', 'processed': 'humanseg_output/38.png'}, {'origin': 'source/42.jpg', 'processed': 'humanseg_output/42.png'}, {'origin': 'source/90.jpg', 'processed': 'humanseg_output/90.png'}, {'origin': 'source/20.jpg', 'processed': 'humanseg_output/20.png'}, {'origin': 'source/82.jpg', 'processed': 'humanseg_output/82.png'}, {'origin': 'source/83.jpg', 'processed': 'humanseg_output/83.png'}, {'origin': 'source/32.jpg', 'processed': 'humanseg_output/32.png'}, {'origin': 'source/36.jpg', 'processed': 'humanseg_output/36.png'}, {'origin': 'source/1.jpg', 'processed': 'humanseg_output/1.png'}, {'origin': 'source/18.jpg', 'processed': 'humanseg_output/18.png'}, {'origin': 'source/65.jpg', 'processed': 'humanseg_output/65.png'}, {'origin': 'source/89.jpg', 'processed': 'humanseg_output/89.png'}, {'origin': 'source/63.jpg', 'processed': 'humanseg_output/63.png'}, {'origin': 'source/37.jpg', 'processed': 'humanseg_output/37.png'}, {'origin': 'source/28.jpg', 'processed': 'humanseg_output/28.png'}, {'origin': 'source/60.jpg', 'processed': 'humanseg_output/60.png'}, {'origin': 'source/88.jpg', 'processed': 'humanseg_output/88.png'}, {'origin': 'source/56.jpg', 'processed': 'humanseg_output/56.png'}, {'origin': 'source/49.jpg', 'processed': 'humanseg_output/49.png'}, {'origin': 'source/53.jpg', 'processed': 'humanseg_output/53.png'}, {'origin': 'source/94.jpg', 'processed': 'humanseg_output/94.png'}, {'origin': 'source/39.jpg', 'processed': 'humanseg_output/39.png'}, {'origin': 'source/10.jpg', 'processed': 'humanseg_output/10.png'}, {'origin': 'source/19.jpg', 'processed': 'humanseg_output/19.png'}, {'origin': 'source/33.jpg', 'processed': 'humanseg_output/33.png'}, {'origin': 'source/64.jpg', 'processed': 'humanseg_output/64.png'}, {'origin': 'source/59.jpg', 'processed': 'humanseg_output/59.png'}, {'origin': 'source/7.jpg', 'processed': 'humanseg_output/7.png'}, {'origin': 'source/30.jpg', 'processed': 'humanseg_output/30.png'}, {'origin': 'source/24.jpg', 'processed': 'humanseg_output/24.png'}, {'origin': 'source/79.jpg', 'processed': 'humanseg_output/79.png'}, {'origin': 'source/73.jpg', 'processed': 'humanseg_output/73.png'}, {'origin': 'source/41.jpg', 'processed': 'humanseg_output/41.png'}, {'origin': 'source/61.jpg', 'processed': 'humanseg_output/61.png'}, {'origin': 'source/91.jpg', 'processed': 'humanseg_output/91.png'}, {'origin': 'source/40.jpg', 'processed': 'humanseg_output/40.png'}, {'origin': 'source/77.jpg', 'processed': 'humanseg_output/77.png'}, {'origin': 'source/80.jpg', 'processed': 'humanseg_output/80.png'}, {'origin': 'source/62.jpg', 'processed': 'humanseg_output/62.png'}, {'origin': 'source/52.jpg', 'processed': 'humanseg_output/52.png'}, {'origin': 'source/13.jpg', 'processed': 'humanseg_output/13.png'}, {'origin': 'source/55.jpg', 'processed': 'humanseg_output/55.png'}, {'origin': 'source/93.jpg', 'processed': 'humanseg_output/93.png'}, {'origin': 'source/34.jpg', 'processed': 'humanseg_output/34.png'}, {'origin': 'source/15.jpg', 'processed': 'humanseg_output/15.png'}, {'origin': 'source/50.jpg', 'processed': 'humanseg_output/50.png'}, {'origin': 'source/27.jpg', 'processed': 'humanseg_output/27.png'}, {'origin': 'source/66.jpg', 'processed': 'humanseg_output/66.png'}, {'origin': 'source/23.jpg', 'processed': 'humanseg_output/23.png'}, {'origin': 'source/29.jpg', 'processed': 'humanseg_output/29.png'}, {'origin': 'source/69.jpg', 'processed': 'humanseg_output/69.png'}, {'origin': 'source/25.jpg', 'processed': 'humanseg_output/25.png'}, {'origin': 'source/57.jpg', 'processed': 'humanseg_output/57.png'}, {'origin': 'source/78.jpg', 'processed': 'humanseg_output/78.png'}, {'origin': 'source/95.jpg', 'processed': 'humanseg_output/95.png'}, {'origin': 'source/76.jpg', 'processed': 'humanseg_output/76.png'}, {'origin': 'source/3.jpg', 'processed': 'humanseg_output/3.png'}, {'origin': 'source/85.jpg', 'processed': 'humanseg_output/85.png'}, {'origin': 'source/6.jpg', 'processed': 'humanseg_output/6.png'}, {'origin': 'source/74.jpg', 'processed': 'humanseg_output/74.png'}, {'origin': 'source/67.jpg', 'processed': 'humanseg_output/67.png'}]
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-VF4UV27S-1588087473441)(output_7_1.png)]
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-rIxXwFwj-1588087473444)(output_7_2.png)]