[PYTHON] I tried running PIFuHD on Windows for the time being

Introduction

PIFuHD was released from Facebook Research! I decided to try PIFuHD as an extension of playing with PIFu before.

In this article, we will describe the procedure from environment construction to executing the sample prepared on Windows.

The great PIFuHD repository is here [https://github.com/facebookresearch/pifuhd)

Execution environment

Environment

Creating a virtual environment

(base)$conda create -n pifu python=3.7.0
(base)$conda activate pifu

Installing the library (I have used pip, so please refer to this and install it with conda install ...)

(pifu)$conda install pytorch torchvision cudatoolkit=10.1 -c pytorch
(pifu)$pip install pillow==6.0.0 scikit-image tqdm opencv-python trimesh
(pifu)$conda install pyopengl

Install GLUT on Windows

This time, I installed Free GLUT instead of the original GLUT. Download "freeglut-MSVC-3.0.0-2.mp.zip" from here → unzip it I copied freeglut.dll located in freeglut \ bin \ x64 \ into C: \ Windows \ System32.

https://tadaoyamaoka.hatenablog.com/entry/2017/02/28/064625

I referred to this article. (Thank you!)

Install ffmpeg

https://fukatsu.tech/windows-ffmpeg

I used the procedure in this article as it is. (Thank you!)

Execution procedure

Code download

(pifu)$git clone https://github.com/facebookresearch/pifuhd.git
(pifu)$cd pifuhd

Model download

(pifu)$mkdir checkpoints
(pifu)$cd checkpoints
(pifu)$wget "https://dl.fbaipublicfiles.com/pifuhd/checkpoints/pifuhd.pt" -O pifuhd.pt
(pifu)$cd ..

If you don't have wget, download pifuhd.pt directly from here and store it under checkpoints.

Fix code

I got an error when using OpenGL in my environment, so I modified lib / render / gl / render.py as follows.

[render.py]
class Render:
    def __init__(self, width=1600, height=1200, name='GL Renderer',
                 program_files=['simple.fs', 'simple.vs'], color_size=1, ms_rate=1):
        self.width = width
        self.height = height
        self.name = name
        self.display_mode = GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH
        self.use_inverse_depth = False

        global _glut_window
        if _glut_window is None:
            glutInit()
            glutInitDisplayMode(self.display_mode)
            glutInitWindowSize(self.width, self.height)
            glutInitWindowPosition(0, 0)
            #Fix here
            # _glut_window = glutCreateWindow("My Render.")
            _glut_window = glutCreateWindow(b"My Render.")

Execute the command of demo.sh

(pifu)$python -m apps.simple_test
(pifu)$python -m apps.render_turntable -f ./results/pifuhd_final/recon -ww 512 -hh 512

When you execute the above command, you will see the following animation on the screen! image.png

In addition, I think that "result_test_512.mp4" is also output under results / pifuhd_final / recon.

in conclusion

This time, I tried running the PIFuHD sample published by Facebook Research on Windows. Basically, if you check README.md, you can easily try it.

In the future, I will try using my own images instead of the prepared samples. PIFu had to be Sementic-Segmentation, but in PIFuHD it seems that the key point information obtained by Pose-Estimation is sufficient. Officially, a trial method using OpenPose was published, but I think that anything can be done if the output format can be matched by the Pose-Estimation algorithm separately.

Recommended Posts

I tried running PIFuHD on Windows for the time being
Run yolov4 "for the time being" on windows
I tried Python on Mac for the first time.
I tried python on heroku for the first time
I tried tensorflow for the first time
I played with Floydhub for the time being
I tried python programming for the first time.
I tried Mind Meld for the first time
I tried running the app on the IoT platform "Rimotte"
I will install Arch Linux for the time being.
AI Gaming I tried it for the first time
I want to move selenium for the time being [for mac]
I tried the Google Cloud Vision API for the first time
I tried changing the python script from 2.7.11 to 3.6.0 on windows10
I want to create a Dockerfile for the time being.
I want to use the Ubuntu desktop environment on Android for the time being (Termux version)
I want to use Ubuntu's desktop environment on Android for the time being (UserLAnd version)
Java programmer tried to touch Go language (for the time being)
For the time being, I want to convert files with ffmpeg !!
I tried running the TensorFlow tutorial with comments (_TensorFlow_2_0_Introduction for beginners)
Python Master RTA for the time being
I tried logistic regression analysis for the first time using Titanic data
[Python] I tried substituting the function name for the function name
I tried running YOLO v3 on Google Colab
For the time being, import them into jupyter
Make a histogram for the time being (matplotlib)
Use logger with Python for the time being
Try using LINE Notify for the time being
I want to use Ubuntu's desktop environment on Android for the time being (Termux version-Japanese input in desktop environment)
For the time being using FastAPI, I want to display how to use API like that on swagger
virtualenv For the time being, this is all!
I tried playing with the calculator on tkinter
I bought Sipeed Lichee Zero so I set it up for the time being
Looking back on the machine learning competition that I worked on for the first time
I tried object detection with YOLO v3 (TensorFlow 2.1) on the GPU of windows!
I tried running pymc
I thought I could make a nice gitignore editor, so I tried to make something like MVP for the time being
I tried running TensorFlow
What I got into Python for the first time
I tried the MNIST tutorial for beginners of tensorflow.
Flow memo to move LOCUST for the time being
Run with CentOS7 + Apache2.4 + Python3.6 for the time being
Molecular dynamics simulation to try for the time being
For the first time, I learned about Unix (Linux).
Next to Excel, for the time being, jupyter notebook
I tried installing the Linux kernel on virtualbox + vagrant
I tried to notify the honeypot report on LINE
I tried running the sample code of the Ansible module
I will try to summarize the links that seem to be useful for the time being
Until you run a Flask application on Google App Engine for the time being
I don't know what HEIC is. But for the time being, let's use PNG!
Kaggle for the first time (kaggle ①)
I tried porting the code written for TensorFlow to Theano
I tried the super-resolution algorithm "PULSE" in a Windows environment
F2py on Miniconda for Windows
I tried replacing the Windows 10 HDD with a smaller SSD
I tried to illustrate the time and time in C language
I tried the changefinder library!
I tried to display the time and today's weather w
Kaguru for the first time
Miscellaneous notes that I tried using python for the matter