Skip to content

YsYusaito/Multi-in-out-model

Repository files navigation

Multi in out model

Overview

[Environment] I created a virtual environment with Anaconda and installed the following packages. GPU:Quadro RTX 6000
・python 3.7.11
・pytorch 1.6.0
・torchvision 0.7.0
・cuda tool kit 10.1
・numpy 1.21.5
・matplotlib 3.5.0
・scikit-learn 1.0.2
・pillow 8.4.0
・tqdm 4.62.3

I installed the latest versions of everything except python, pytorch, torchvision, and cuda toolkit. ※Only tqdm was installed by pip.

※Supported cuda tool kit, pytorch, and torch vision versions differ depending on the GPU used.
Please install the appropriate versions of the cuda tool kit, pytorch, and torch vision, see here.

[Data]
CelebA
about CelebA

celeba_overview
↑There are nearly 300,000 images of men and women laughing.

[Network]
multi_inout_network
Original information of this network

・In the learning process, we tried to determine whether the image was male or female (first label), and whether it was smiling or non-smiling (second label).
・The parameters of the entire model were updated by learning.
・6000 images were obtained from the dataset for each of male, female/smiling, and non-smiling, for a total of 24000 images. (We did not use all the images to save memory and training time.)
・number of training data:number of test data = 9:1
・epoch:3
・learning rate:0.0001

[Training loss・accuracy]
・loss
loss
・accuracy
acc

Procedure of model training

  1. git clone
    Link:git@github.com:YsYusaito/Multi-in-out-model.git or https://github.com/YsYusaito/Multi-in-out-model.git

  2. down load data

    • access to homepage of CelebA
    • click Google Drive
      celeba_google_drive
    • click img
      celeba_img
    • download img_align_celeba.zip
      celeba_zip
    • click Anno
      celeba_anno
    • download list_attr_celeba.txt
      celeba_list_attr
  3. In the folder where this readme is located, extract img_align_celeba.zip. Then you will find the img_align_celeba folder.

  4. Create a folder "CelebA_dataset" in the folder where this readme is located.

  5. Place list_attr_celeba.txt directly under the folder "CelebA_dataset".

  6. Execute preprare_dataset.py The execution of this script creates folders "00_male_smiling", "01_male_Nonsmiling", "10_female_smiling", and "11_female_Nonsmiling" in the folder "CelebA_dataset", which contains images for each class.

  7. Execute train_multi_inout_model.py

    • model will be output in the folder "model".
       ※multi_inout_weight.pth → torch.save(model.state_dict(), 'Destination path and save name')
      multi_inout_model.pth → torch.save(model, 'Destination path and save name')
      about saving models by pytorch

    Final folder structure (the folder where readme is stored)

    ・CelebA_dataset
    00_male_smiling
    01_male_Nonsmiling
    10_female_smiling
    11_female_Nonsmiling

    ・img_align_celeba

    ・model

    Inference

    Execute test_inference.py
    If the following log is displayed, success.
    inference_log

    First element of y0_out: score of male
    Second element of y0_out: score of female

    First element of y1_out: score of smiling
    Second element of y1_out: score of non-smiling

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages