from __future__ import absolute_import from __future__ import division from __future__ import print_function import os from Dataset import Dataset from GazeGAN import Gaze_GAN from config.train_options import TrainOptions opt = TrainOptions().parse() os.environ['CUDA_VISIBLE_DEVICES'] = str(opt.gpu_id) if __name__ == "__main__": dataset = Dataset(opt) gaze_gan = Gaze_GAN(dataset, opt) gaze_gan.build_model() gaze_gan.train()
from __future__ import absolute_import from __future__ import division from __future__ import print_function import os from Dataset import Dataset from GazeGAN import Gaze_GAN from config.test_options import TestOptions opt = TestOptions().parse() os.environ['CUDA_VISIBLE_DEVICES'] = str(opt.gpu_id) if __name__ == "__main__": dataset = Dataset(opt) gaze_gan = Gaze_GAN(dataset, opt) gaze_gan.build_test_model() gaze_gan.test()
import os from Dataset import Dataset from config import Config from GazeGAN import Gaze_GAN if __name__ == "__main__": config = Config() print config.exp_name if config.CUDA: os.environ['CUDA_VISIBLE_DEVICES'] = str(config.gpu_id) dataset = Dataset(config) gaze_gan = Gaze_GAN(dataset, config) gaze_gan._init_inception() gaze_gan.build_model() if config.is_training: gaze_gan.train() else: gaze_gan.test()
# ###output_data = gaze_gan.test_webcam(input_data) img = cv2.imread('dataset/CustomData/IMG/0040a.jpg') # while(1): # cv2.imshow('IMG', img) # if cv2.waitKey(1) & 0xFF == ord('q'): # break input_data = (img, 92, 107, 175, 103) cap.release() cv2.destroyAllWindows() ## RUN TEST dataset = Dataset(opt) gaze_gan = Gaze_GAN(dataset, opt) gaze_gan.build_test_model() return_output = gaze_gan.test_webcam(input_data) final_output = (return_output + 1.0) print(final_output) final_output = final_output * 127.5 final_output = np.array(final_output, dtype=np.uint8) print(final_output) while (1): cv2.imshow('IMG', final_output) if cv2.waitKey(1) & 0xFF == ord('q'): break
import os import time from Dataset import Dataset from GazeGAN import Gaze_GAN from OpenVinoGazeCorrection import openVinoGazeGan from config.train_options import TrainOptions opt = TrainOptions().parse() os.environ['CUDA_VISIBLE_DEVICES'] = str(opt.gpu_id) if __name__ == "__main__": dataset = Dataset(opt) start_time = time.time() gaze_gan = Gaze_GAN(dataset, opt) gaze_gan.build_test_model() gaze_gan.test(freeze_model=False, flag_save_images=True, custom_dataset=True, num_custom_images=10) print( "\n \n OUTER Time elapsed in GazeGan inference using TF of 3451 images = ", time.time() - start_time) start_time = time.time() openVinoGazeGan.main(dataset, opt, save_images=True, custom_dataset=True, num_custom_images=10) print("\n \n OUTER Time elapsed in OV inference of 3451 images = ",