CoCosNet-v2 icon indicating copy to clipboard operation
CoCosNet-v2 copied to clipboard

training on custome dataset

Open orydatadudes opened this issue 3 years ago • 2 comments

hello, you used OpenPose to create pose *.txt files how i can create thous files for another data set ? i follow the link for OpenPose but i i can't see where the pose *.txt files are made , i can see only the pose images results thank you

orydatadudes avatar Jan 02 '22 12:01 orydatadudes

Same here. I'd like to try it on a totally unrelated set of images (photos and sketches). Any guidance on how to go about would be appreciated.

krummrey avatar Jan 26 '22 09:01 krummrey

import cv2
import numpy as np
import os
from src.body import Body

class PoseKeyPoint():
    def __init__(self):
        #change the two path
        self.path = '../dataset/yourdataset/img'
        self.out = '../dataset/yourdataset/pose'

    def pose(self):
        # body_pose_model.pth you can download from OpenPose and put it under the models folder
        body_estimation = Body('../models/body_pose_model.pth')
        filelist = os.listdir(self.path)
        for item in filelist:
            oriImg = cv2.imread(os.path.join(self.path,item))  # B,G,R order
            candidate, subset = body_estimation(oriImg)
            file_candidate = os.path.join(self.out,os.path.splitext(item)[0]+'_candidate.txt')
            file_subset = os.path.join(self.out,os.path.splitext(item)[0]+'_subset.txt')
            np.savetxt(file_candidate,candidate)
            np.savetxt(file_subset,subset)
            print(item)
if __name__ == '__main__':
    pose = PoseKeyPoint()
    pose.pose()

Django-Yu avatar Mar 17 '22 06:03 Django-Yu