[MYAI Studio SDK] Image-GAN-Compression-PyTorch-Jupyter

Image-GAN-Compression-PyTorch-Jupyter is to perform style conversion after compressing the GAN model. The compressed model not only reduces the amount of calculation, reduces the size of the model, but also maintains a certain degree of accuracy. This solution can be applied to the style conversion of horses or shoes.

 

[Instruction]

 

There are two ways of style conversion:

 

(1) CycleGan compression. The process of turning the horse in the image into a zebra is as follows:

Train the original size CycleGan model -> test the original size CycleGan model -> distill the original size CycleGan model -> test the distilled model -> train the supernet with the distilled model -> test the supernet model -> compress the supernet model -> Test the compressed model

 

(2) Compression of pix2pix. The process of converting the outline drawing of the shoe into a sample drawing of the shoe is as follows:

Train the original size pix2pix model -> test the original size pix2pix model -> distill the original size pix2pix model -> test the distilled model -> train the supernet with the distilled model ->  compress the supernet model -> Test the compressed model

 

Note: Please confirm whether the pip numpy version is 1.18.1 before running.

 

CycleGan:

 

1.  1_train_CycleGan.ipynb

Train the CycleGan model. The data set is "horse2zebra", images of horses and zebras.

 

2. 2_test_CycleGan_model_mobile.ipynb

Test the CycleGan model trained at point 1. If the CycleGan model test result is not good, it will affect the subsequent model training, please go back to the first point and retrain.

 

3. 3_train_CycleGan_distill.ipynb

Distill the model from the CycleGan model at point 1.

 

4. 4_test_CycleGan_distill_model.ipynb

Test the distillation model of Cycle Gan at point 3. If you think the result is not good, please go back to point 3 and retrain.

 

5. 5_train_CycleGan_supernet.ipynb

Train the supernet with the distilled CycleGan model and the original CycleGan model.

 

6. 6_test_CycleGan_supernet_model.ipynb

Test Point 5 CycleGan's supernet model. If you think the result is not good, please go back to point 3 and retrain.

 

7.7_model_compression_CycleGan.ipynb

Use CycleGan's supernet model for training to produce a compressed model.

 

8. 8_inference_CycleGan_compression.ipynb

Test the compressed CycleGan model.

real_A is the image of horse, fake_B is the image of horse converted into zebra.

 

Gan compress cyclegan.png

 

 

pix2pix:

 

1. 1_train_Pix2pix.ipynb

Train the pix2pix model. The data set is "edges2shoes-r", the image of the shoe outline.

 

2. 2_test_Pix2pix_model_mobile.ipynb

Test the pix2pix model trained at point 1. If the pix2pix model test result is not good, it will affect the subsequent model training, please go back to the first point and retrain.

 

3. 3_train_Pix2pix_distill.ipynb

Distill the model from the pix2pix model at point 1.

 

4. 4_test_Pix2pix_distill_model.ipynb

Test the distillation model of pix2pix at point 3. If you think the result is not good, please go back to point 3 and retrain.

 

5. 5_train_Pix2pix_supernet.ipynb

Train the supernet with the distilled pix2pix model and the original pix2pix model.

 

6. 7_model_compression_Pix2pix.ipynb

Use pix2pix 's supernet model for training to produce a compressed model.

 

7. 8_inference_Pix2pix_compression.ipynb

Test the compressed pix2pix model.

real_A is the contour image of the shoe, fake_B is the contour image of the shoe converted into a sample image of the shoe, and real_B is the real sample image of the contour image of the shoe.

 

GAN Compression pix2pix.png

 

This SDK is built in AppForAI - AI Dev Tools.

 

Purchase license separately: USD 600, permanent authorization, single APP authorization, single machine authorization, one-year activation, one-year download, one-year update, one-year email technical support.

Contact Us and How to Buy


Welcome to contact us. Please refer to the following link:

https://www.myai168.com/article/index?sn=11059

Recommended Article

1.
MYAI Studio for Windows

2.
MYAI Studio for Linux

3.
Featured AI Computers

Thanks for our customers

Taiwan University, Tsing Hua University, Yang Ming Chiao Tung University, Cheng Kung University, Taipei Medical University, Taipei University of Nursing and Health Sciences, National Chung Hsing University, Chi Nan University, Ilan University, United University, Defence University, Military Academy, Naval Academy, Feng Chia University, Chang Gung University, I-Shou University, Shih Chien University, Taiwan University of Science and Technology, Taichung University of Science and Technology, Yunlin University of Science and Technology, Chin-Yi University of Science, Formosa University, Pintung University of Science and Technology, Kaohsiung University of Science and Technology, Chaoyang University of Technology, Ming Chi University of Technology, Southern Taiwan University of Science and Technology, China University of Technology, Gushan Senior High School, Taipei Veterans General Hospital, Chang Gung Medical Foundation, Tzu Chi Medical Foundation, E-Da Hospital, Industry Technology Research Institute, Institute for Information Industry, Chung-Shan Institute of Science and Technology, Armaments Bureau, Ministry of Justice Investigation Bureau, Institute of Nuclear Energy Research, Endemic Species Research Institute, Institute of Labor, Occupational Safety And Health, Metal Industries Research & Development Centre, Taiwan Instrument Research Institute, Automotive Research & Testing Center, Taiwan Water Corporation, Taiwan Semiconductor Manufacturing Co., Ltd., United Microelectronics Corp., Nanya Technology, Winbond Electronics Corp., Xintec Inc., Arima Lasers Corporation, AU Optronics Corporation, Innolux Corporation, HannStar Display Corporation, Formosa Plastics Group., Formosa Technologies Corporation, Nan Ya Plastics Corp., Formosa Chemicals & Fibre Corporation, Chinese Petroleum Corporation, Logitech, ELAN Microelectronics Corp., Lextar Electronics Corporation, Darfon Electronics Corp., WPG Holdings, Mirle Automation Corporation, Symtek Automation Asia Co., Ltd, ChipMOS Technologies Inc., Dynapack International Technology Corporation, Primax Electronics Ltd., Feng Hsin Steel, China Ecotek, Grade Upon Technology Corp., AAEON Technology Inc., Stark Technology, Inc., Horng Terng Automation Co., Ltd., Zhen Ding Technology Holding Ltd, Boardtek Electronics Corporation, MiTAC International Corporation, Allion Labs, Inc., Sound Land Corp., Hong Hu Tech, etc.