Git Product home page Git Product logo

zhu-geliang-ddpm's Introduction

This repostory is inspired by / based on the following repositories:


images

Generate Zhu-Geliang face by DDIM

you can download the pre-trained model from here.
put zhu_geliang.pth to the checkpoints folder.
After that you can run the following command to generate Zhu-Geliang face:

python .\generate.py -cp ./checkpoint/zhu_geliang.pth -bs 1 --interval 10 --show -sp "result/zhugeliang.png" --sampler "ddim" --steps 200

These are the parameters of generate.py :

  • -cp : the path of checkpoint.
  • --device : the device used. 'cuda' (default) or 'cpu'.
  • --sampler : the sampler method, can be 'ddpm'(default) or 'ddim'.
  • -bs : how many images to generate at once. Default 16.
  • --result_only : whether to output only the generated results. Default False.
  • --interval : extract an image every how many steps. Only valid without the result_only parameter. Default 50.
  • --eta : ddim parameter, in the paper. Default 0.0.
  • --steps : ddim sampling steps. Default 100.
  • --method : ddim sampling method. can be 'linear'(default) or 'quadratic'.
  • --nrow : how many images are displayed in a row. Only valid with the result_only parameter. Default 4.
  • --show : whether to display the result image. Default False.
  • -sp : save path of the result image. Default None.
  • --to_grayscale : convert images to grayscale. Default False.

This check point will generate 64x64 image, If you want to generate custom size images, you can train the model with different image_size parameter in config.yml file.

Train your own model

Zhu-Geliang face datasets

I use yolov5-crowdhuman to make the Zhu-Geliang datasets, and I use the opencv cv2.face.LBPHFaceRecognizer to find the face of Zhu-Geliang.
If you want to see the code, please go to the branch ZhuGeliangRecognizer, and you can find the code in the following files: FaceDetectionAndCrop.py and Find_Zhu_Geliang.py

I upload the datasets to the Kaggle, you can download it from here derectly.

images

put this all datasets to zhugeliang_face folder

Make square image

images

python Create_Square_Datasets.py --size 64 --num-threads 16

These are the parameters of Create_Square_Datasets.py :

  • --datasets-path : the path of the datasets. default isdata/zhugeliang_face
  • --output-path : the path of the output datasets. default isdata/zhugeliang_face_square
  • --size : the size of the output image. default is 64, if you want to train another size image, you can change it.
  • --num-threads : the number of threads. default is 16, if you have more than 16 cores, you can change it.

Train

Almost all the parameters that can be modified are listed in the config.yml file. You can modify the relevant parameters as needed, and then run the train.py file to start training.

python train.py

Result

images

My Training Loss

images

zhu-geliang-ddpm's People

Contributors

yuan-0816 avatar

Watchers

 avatar

zhu-geliang-ddpm's Issues

Ey yo bro!!!

——————————————————
┈╭━━━━━━━━━━━╮┈
┈┃╭━━━╮┊╭━━━╮┃┈
╭┫┃┈▇┈┃┊┃┈▇┈┃┣╮
┃┃╰━━━╯┊╰━━━╯┃┃
╰┫╭━╮╰━━━╯╭━╮┣╯
┈┃┃┣┳┳┳┳┳┳┳┫┃┃┈
┈┃┃╰┻┻┻┻┻┻┻╯┃┃┈
┈╰━━━━━━━━━━━╯┈
.……..… /´¯/)………....(\¯.............
……….../….//……….. …\….. ........
………../….//………… ….\….. ......
…../´¯/…./´¯\………../¯ \….\¯`.....
.././.../…./…./.|……|.\….\….\….
(.(….(….(…./.)..)..(..(.\….)….)….).)
.\……………./../…....../…………../
..\…………….. /……..\…………….../
…\…………... (...…….)……………..

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.