zoukankan      html  css  js  c++  java
  • Tensorflow——用openpose进行人体骨骼检测

    https://blog.csdn.net/eereere/article/details/80176007

    参考资料
    code:https://github.com/ildoonet/tf-pose-estimation
    paper:https://arxiv.org/pdf/1611.08050.pdf
    Mark的教学视频:https://www.youtube.com/watch?v=nUjGLjOmF7o
                             (视频里特别详细,从conda环境,安装tensorflow,到最后的run)

    需要的软件
    python3
    tensorflow 1.3.0+(作者说要1.4.1,我的cuda是8.0,只能用1.3.0)
    opencv3, protobuf, python3-tk
    0)准备工作
    下载code:https://github.com/ildoonet/tf-pose-estimation
    activate 你的环境
    打开 tf-pose-estimation-master文件夹

    1)安装必要的requirements
    pip3 install -r requirements.txt

    在安装ast时会报错: FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users.....
    不用管,Python已经有ast了
    所以把ast删掉,再pip install一遍
    2)运行

    检测图像:
    python src/run.py --model=mobilenet_thin --resolution=432x368 --image=×××.jpg
    ①整个人都没有检测到

    ②左腿没有检测到

    ③整个人都检测到了

    检测本地视频:

    python src/run_video.py --model=mobilenet_thin --resolution=432x368 --video=child.mp4

    加了几句代码就可以将视频保存到本地

         fourcc = cv2.VideoWriter_fourcc('M', 'P', '4', '2')
            outVideo = cv2.VideoWriter('save.avi',fourcc,fps,size)
         
            if (cap.isOpened()== False):
                print("Error opening video stream or file")
            while(cap.isOpened()):
                ret_val, image = cap.read()
         
         
                humans = e.inference(image)
                image = TfPoseEstimator.draw_humans(image, humans, imgcopy=False)
         
                #logger.debug('show+')
                cv2.putText(image,
                            "FPS: %f" % (1.0 / (time.time() - fps_time)),
                            (10, 10),  cv2.FONT_HERSHEY_SIMPLEX, 0.5,
                            (0, 255, 0), 2)
                cv2.imshow('tf-pose-estimation result', image)
                outVideo.write(image)
                fps_time = time.time()
                if cv2.waitKey(1) == 27:
                    break

    从抖音上下载了一个短视频,下面是检测结果,视频检测的结果还是非常好的
    但是事实检测FPS仍然有些慢
     

  • 相关阅读:
    Unity 坐标系及相互转化
    Unity 接口&接口类
    Unity 场景管理/切换
    Unity 光照系统中的阴影
    《算法竞赛进阶指南》0x41并查集 银河英雄传说(边带权并查集)
    《算法竞赛进阶指南》0x41并查集 NOI2015程序自动分析
    《算法竞赛进阶指南》0x38概率与期望 扑克牌
    《算法竞赛进阶指南》0x38概率与数学期望 绿豆蛙的归宿
    《算法竞赛进阶指南》0x38概率与数学期望 Rainbow
    基于Python的模拟退火算法SA 以函数极值+TSP问题为例(gif动态展示)
  • 原文地址:https://www.cnblogs.com/shuimuqingyang/p/10102872.html
Copyright © 2011-2022 走看看