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仍然有些慢
     

  • 相关阅读:
    favourite programming quotes
    a fast algorithm to compute the area of a polygon
    customize your own memory allocator (2)
    一道概率算法
    study on source code of Tcmalloc
    智力题2
    how does malloc/free work?
    Windows PowerShell系列课程(视频课程讲师:李大川)
    跟我一起学Visual Studio 2008系列课程(视频课程讲师:徐长龙)
    C# 3.0 锐利体验系列课程(视频课程讲师:李建忠)
  • 原文地址:https://www.cnblogs.com/shuimuqingyang/p/10102872.html
Copyright © 2011-2022 走看看