Mynet实现
运行命令:--g_ckpt=/home/joselyn/workspace/0419-course/stylenerf_pkl/ffhq_256.pkl --outdir=/home/joselyn/workspace/0419-course/logs/StyleNeRF-main/train_mynet/debug --data=/home/joselyn/workspace/0419-course/logs/StyleNeRF-main/dataset_create/Mydataset
记录一些中间变量
一个batch对应的相机参数如下:
经过rec_ws_1,rec_cm_1 = E(img_1)
之后:
因为无法从camera_matrices反向计算得到mode,
所以,保存数据集的时候,直接把mode存下来。
运行测试
报错
File "/home/joselyn/workspace/0419-course/StyleNeRF-main1/dnnlib/camera.py", line 174, in look_at
x_axis = normalize(torch.cross(up[None,:].expand_as(z_axis), z_axis, dim=-1))
RuntimeError: expected scalar type Float but found Double
和train_encoder对应的部分进行对比。
train_encoder 在调用camera_matrices = G.synthesis.get_camera(batch, device, mode=c_samples)
之前:
发现后者的device在 cpu上面。
报错:
File "/home/joselyn/workspace/0419-course/StyleNeRF-main1/dnnlib/camera.py", line 174, in look_at
x_axis = normalize(torch.cross(up[None,:].expand_as(z_axis), z_axis, dim=-1))
RuntimeError: Expected object of scalar type Float but got scalar type Double for argument #2 'other' in call to _th_cross_kernel_out
修改为float类型。
运行成功
尝试使用预训练过的encoder
命令:python -W ignore train_mynet.py --g_ckpt=/home/joselyn/workspace/0419-course/stylenerf_pkl/ffhq_256.pkl --e_ckpt=/home/joselyn/workspace/0419-course/logs/StyleNeRF-main/train_encoder_1GPU/checkpoints/network-snapshot-000900.pkl --outdir=/home/joselyn/workspace/0419-course/logs/StyleNeRF-main/train_mynet/train_test --data=/home/joselyn/workspace/0419-course/logs/StyleNeRF-main/dataset_create/Mydataset --max_steps=100
效果不错。
训练到60w+batch的时候,效果如下:
尝试调整代码:
增加ws 的平均值
rec_ws_1+=ws_avg
rec_ws_2+=ws_avg
效果如下:
一开始从平均值开始学习
图像还是在逐渐毛玻璃化。
文章出处登录后可见!