tranluan / Nonlinear_Face_3DMM

Source code for "Nonlinear 3D Face Morphable Model"
http://cvlab.cse.msu.edu/project-nonlinear-3dmm.html
Apache License 2.0
676 stars 124 forks source link

About when using parallel computer being shut down #31

Open linshuheng6 opened 4 years ago

linshuheng6 commented 4 years ago

Hello Trabluan, Thank you for your great work. When I run your code(I use python 3.6), I change the code in opts.py: out_split.append(fn(**{k : v[i] for k, v in in_splits.items()})) is replaced by:


dict_tem = {}
                for k,v in in_splits.items():
                    if(type(v)==list):
                        dict_tem[k] = v[i]
                    else:#'zip'
                        if i == 0:
                            temp_zip[k] = list(v)
                            dict_tem[k] = temp_zip[k][i]
                        else:
                            dict_tem[k] = temp_zip[k][i]
out_split.append(fn(**dict_tem))

Because I got the error when I used the original code: TypeError: 'zip' object is not subscriptable

I can run the 'main' file with only one GPU, but when I set 'flags.DEFINE_string("gpu", "0,1", "GPU to use [0]")' , the computer will be shut down when the program was run.

The initial settings are below:

flags.DEFINE_integer("epoch", 25, "Epoch to train [25]")
flags.DEFINE_float("learning_rate", 0.001, "Learning rate of for adam [0.0002]")
flags.DEFINE_float("beta1", 0.5, "Momentum term of adam [0.5]")
flags.DEFINE_integer("train_size", 5000000, "The size of train images [np.inf]")
flags.DEFINE_integer("batch_size", 16, "The size of batch images [64]")
flags.DEFINE_integer("sample_size", 64, "The size of batch samples images [64]")
flags.DEFINE_integer("image_size", 108, "The size of image to use (will be center cropped) [108]")
flags.DEFINE_integer("output_size", 224, "The size of the output images to produce [64]")
flags.DEFINE_integer("c_dim", 3, "Dimension of image color. [3]")
flags.DEFINE_boolean("is_with_y", True, "True for with lable")
flags.DEFINE_string("dataset", "celebA", "The name of dataset [celebA, mnist, lsun]")
flags.DEFINE_string("checkpoint_dir", "checkpoint", "Directory name to save the checkpoints [checkpoint]")
flags.DEFINE_string("samples_dir", "samples", "Directory name to save the image samples [samples]")
flags.DEFINE_boolean("is_train", True, "True for training, False for testing [False]")
flags.DEFINE_boolean("is_reduce", False, "True for 6k verteices, False for 50k vertices")
flags.DEFINE_boolean("is_crop", False, "True for training, False for testing [False]")
flags.DEFINE_boolean("visualize", False, "True for visualizing, False for nothing [False]")
flags.DEFINE_integer("gf_dim", 32, "")
flags.DEFINE_integer("gfc_dim", 320, "")
flags.DEFINE_integer("df_dim", 32, "")
flags.DEFINE_integer("dfc_dim", 320, "")
flags.DEFINE_integer("z_dim", 20, "")
flags.DEFINE_string("gpu", "0,1", "GPU to use [0]")

flags.DEFINE_boolean("is_pretrain", False, "Is in pretrain stage [False]")

flags.DEFINE_boolean("is_using_landmark", False, "Using landmark loss [False]")
flags.DEFINE_boolean("is_using_symetry", True, "Using symetry loss [False]")
flags.DEFINE_boolean("is_using_recon", False, "Using rescontruction loss [False]")
flags.DEFINE_boolean("is_using_frecon", False, "Using feature rescontruction loss [False]")
flags.DEFINE_boolean("is_using_graddiff", False, "Using gradient difference [False]")
flags.DEFINE_boolean("is_gt_m", False, "Using gt m [False]")
flags.DEFINE_boolean("is_partbase_albedo", False, "Using part based albedo decoder [False]")
flags.DEFINE_boolean("is_using_linear", False, "Using linear model supervision [False]")
flags.DEFINE_boolean("is_batchwise_white_shading", True, "Using batchwise white shading constraint [False]")
flags.DEFINE_boolean("is_const_albedo", True, "Using batchwise const albedo constraint [False]")
flags.DEFINE_boolean("is_const_local_albedo", True, "Using batchwise const albedo constraint [False]")
flags.DEFINE_boolean("is_smoothness", True, "Using pairwise loss [False]")

I think it was not cpu or memery's problem. Could you please help to run this code with multiple GPUs. Python3.5 & Tensorflow1.12

Thanks!!

linshuheng6 commented 4 years ago

The Pretraining and Finetuning commands are lost on the page. Could someone share it to me ?