GithubHelp home page GithubHelp logo

About pose keypoints about dressing-in-order HOT 2 CLOSED

cuiaiyu avatar cuiaiyu commented on September 21, 2024
About pose keypoints

from dressing-in-order.

Comments (2)

cuiaiyu avatar cuiaiyu commented on September 21, 2024

Option 1:
Follow Get Started -> Data Preparation -> Optionally, you can also generate these files by yourself. in PATN Repository to get the key points label.

Option 2:
For a test image xxx.jpg, run openpose to get the keypoints file xxx_keypoints.json (Body_25 label), and then you can load the key points as pytorch Tensor for the single test image by function

def load_pose_from_json(pose_json, target_size=(256,256), orig_size=(256,256)):
    '''
    This function converts the OpenPose detected key points (in .json file) to the desired heatmap.
    input: 
    - pose_json (str): the file_path of the OpenPose detection in .json.
    - target_size (tuple): the size of output heatmap
    - orig_size (tuple): the size of original image that is used for OpenPose to detect the key points.
    Output:
    - heatmap (torch.Tensor) : the heatmap in size 18xHxW as specified by target_size 
    '''
    with open(pose_json, 'r') as f:
        anno = json.load(f)
    if len(anno['people']) < 1:
        a,b = target_size
        return torch.zeros((18,a,b))
    anno = list(anno['people'][0]['pose_keypoints_2d'])
    x = np.array(anno[1::3])
    y = np.array(anno[::3])
    
    x[8:-1] = x[9:]
    y = np.array(anno[::3])
    y[8:-1] = y[9:]
    x[x==0] = -1
    y[y==0] = -1
    coord = np.concatenate([x[:,None], y[:,None]], -1)
    pose  = pose_utils.cords_to_map(coord, target_size, orig_size)
    pose = np.transpose(pose,(2, 0, 1))
    pose = torch.Tensor(pose)
    return pose[:18]

from dressing-in-order.

Djvnit avatar Djvnit commented on September 21, 2024

Hi @cuiaiyu , Thanks a lot for this great work.
I'm working on Cloth Virtual Try-On as my Final Year Project.
The demo worked fine for me but currently I'm facing some issues in performing virtual try-on on my own image.
Steps I followed:

  1. Resized by full size image .jpg to 750x1101 pixels (as all the images in test folder are of this dimension) and added it to test folder.

  2. Ran openpose on the image and obtained the keypoints in .json file, manually separated x and y keypoints as (x0, y0, c0, x1, y1, c1, ....) and added the file name along with 2D_pose_keypoint y and x keypoints respectively in fasion-annotation-test.csv .

  3. Using SCHP found the human parsing and added it to testM_lip.

  4. Added image name in test.lip and standard_test_anns.txt under print just for testing.

  5. After that I just ran the demo.ipynb and got the following error in data loading step.
    image

I tried a lot to resolve this error but I'm unable to get it also I'm approaching the deadline. Kindly help me to test the model on custom image.

Also I'm unable to understand the use of fasion-pairs-test.csv while running demo.

Hopeful for your kind reply.
Thanks a lot Cuiaiyu !!!

from dressing-in-order.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.