Giter Club home page Giter Club logo

Comments (5)

thaoshibe avatar thaoshibe commented on May 25, 2024

Hi, you should modify the code from Line34

Line 34-36: Get UV texture image of imageA and imageB. If you want to directly input the UV texture, please comment L34-36.

from cpm.

goldwater668 avatar goldwater668 commented on May 25, 2024

@thaoshibe
Run according to your above operation, report the following error:
Traceback (most recent call last):
File "main.py", line 58, in
output = model.render_texture(new_txt)
File "/data/hjq/CPM/makeup.py", line 132, in render_texture
self.triangles.T,
AttributeError: 'Makeup' object has no attribute 'triangles'

from cpm.

thaoshibe avatar thaoshibe commented on May 25, 2024

Hi @seawater668 ,
I'm not sure what you're trying to get. As far as I understand, your inputs are UW-maps, and you want to get outputs as UV maps as well.
Then, please comment Line 47, 48 too.

Sorry I can't assist you further. But if you want to modify anything, starting debug from here is a good start.
Thank youu.

from cpm.

goldwater668 avatar goldwater668 commented on May 25, 2024

@thaoshibe
if name == "main":
args = get_args()
model = Makeup(args)

imgA = np.array(Image.open(args.input))
imgB = np.array(Image.open(args.style))
imgA = cv2.resize(imgA, (256, 256))
imgB = cv2.resize(imgB, (256, 256))
A_txt = imgA.copy()
B_txt = imgB.copy()
# model.prn_process(imgA)
# A_txt = model.get_texture()
# B_txt = model.prn_process_target(imgB)
if args.color_only:
    output = color_makeup(A_txt, B_txt, args.alpha)
elif args.pattern_only:
    output = pattern_makeup(A_txt, B_txt)
else:
    color_txt = model.makeup(A_txt, B_txt) * 255

    cv2.imwrite('./0929/color_txt.jpg', color_txt)
    mask = model.get_mask(B_txt)
    mask = (mask > 0.001).astype("uint8")
    cv2.imwrite('./0929/mask.jpg', mask)
    new_txt = color_txt * (1 - mask)[:, :, np.newaxis] + B_txt * mask[:, :, np.newaxis]
    cv2.imwrite('./0929/new_txt.jpg', new_txt)
    output = model.render_texture(new_txt)
    output = model.blend_imgs(model.face, output, alpha=1)

x2, y2, x1, y1 = model.location_to_crop()
output = np.concatenate([imgB[x2:], model.face[x2:], output[x2:]], axis=1)
if not os.path.exists(args.savedir):
    os.makedirs(args.savedir)
save_path = os.path.join(args.savedir, "result.png")

Image.fromarray((output).astype("uint8")).save(save_path)
print("Completed 👍 Please check result in: {}".format(save_path))

from cpm.

thaoshibe avatar thaoshibe commented on May 25, 2024

As mentioned above: Sorry I can't assist you further. But if you want to modify anything, starting debug from here is a good start.
Thank you!.

from cpm.

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.