2018-01-24 修改py文件解决了人脸识别模型生成中需要显卡的问题

python testBatchModel.py testBatchModel.txt ../data/robert/

Prepare image ../data/paper/imgs/test3dfacedetection.jpg:
Number of faces detected: 1
CNN Model loaded to regress 3D Shape and Texture!
('> Processing image: ', '../data/robert//imgs/test3dfacedetection.png', ' ', 'test3dfacedetection.png', ' ', '1/1')
/root/anaconda2/lib/python2.7/site-packages/skimage/transform/warps.py:84: UserWarning: The default mode, 'constant', will be changed to 'reflect' in skimage 0.15.
warn("The default mode, 'constant', will be changed to 'reflect' in "
Regress bump maps
Traceback (most recent call last):
File "testBatchModel.py", line 183, in
bumpMapRegressor.estimateBump(bumpModel_path, data_out + "/imList.txt", data_out + "/bump/")
File "/home/pythonhack/extreme_3d_faces-master/demoCode/bumpMapRegressor.py", line 336, in estimateBump
net.load_state_dict(torch.load(modelPath));
File "/root/anaconda2/lib/python2.7/site-packages/torch/serialization.py", line 261, in load
return load(f, map_location, pickle_module)
File "/root/anaconda2/lib/python2.7/site-packages/torch/serialization.py", line 409, in load
result = unpickler.load()
File "/root/anaconda2/lib/python2.7/site-packages/torch/serialization.py", line 380, in persistent_load
data_type(size), location)
File "/root/anaconda2/lib/python2.7/site-packages/torch/serialization.py", line 86, in default_restore_location
result = fn(storage, location)
File "/root/anaconda2/lib/python2.7/site-packages/torch/serialization.py", line 68, in cuda_deserialize
return obj.cuda(device)
File "/root/anaconda2/lib/python2.7/site-packages/torch/utils.py", line 61, in cuda
with torch.cuda.device(device):
File "/root/anaconda2/lib/python2.7/site-packages/torch/cuda/init.py", line 186, in enter
lazy_init()
File "/root/anaconda2/lib/python2.7/site-packages/torch/cuda/init.py", line 120, in lazy_init
check_driver()
File "/root/anaconda2/lib/python2.7/site-packages/torch/cuda/init.py", line 62, in check_driver
http://www.nvidia.com/Download/index.aspx""")
AssertionError:
Found no NVIDIA driver on your system. Please check that you
have an NVIDIA GPU and installed a driver from
http://www.nvidia.com/Download/index.aspx
Segmentation fault
[root@master@/home/pythonhack/extreme_3d_faces-master/demoCode@16:36:55]
2130 $ vi "/root/anaconda2/lib/python2.7/site-packages/torch/serialization.py"
[root@master@/home/pythonhack/extreme_3d_faces-master/demoCode@16:37:25]
2131 $ vi +68 "/root/anaconda2/lib/python2.7/site-packages/torch/serialization.py"
[root@master@/home/pythonhack/extreme_3d_faces-master/demoCode@16:37:48]
2132 $ python testBatchModel.py testBatchModel.txt ../data/robert/
Prepare image ../data/paper/imgs/test3dfacedetection.jpg:
Number of faces detected: 1
CNN Model loaded to regress 3D Shape and Texture!
('> Processing image: ', '../data/robert//imgs/test3dfacedetection.png', ' ', 'test3dfacedetection.png', ' ', '1/1')
/root/anaconda2/lib/python2.7/site-packages/skimage/transform/warps.py:84: UserWarning: The default mode, 'constant', will be changed to 'reflect' in skimage 0.15.
warn("The default mode, 'constant', will be changed to 'reflect' in "
Regress bump maps
['add', 'and', 'array', 'array_wrap', 'bool', 'class', 'deepcopy', 'delattr', 'delitem', 'dict', 'div', 'doc', 'eq', 'float', 'format', 'ge', 'getattribute', 'getitem', 'getstate', 'gt', 'hash', 'iadd', 'iand', 'idiv', 'ilshift', 'imul', 'init', 'int', 'invert', 'ior', 'ipow', 'irshift', 'isub', 'iter', 'itruediv', 'ixor', 'le', 'len', 'long', 'lshift', 'lt', 'matmul', 'mod', 'module', 'mul', 'ne', 'neg', 'new', 'nonzero', 'or', 'pow', 'radd', 'rdiv', 'reduce', 'reduce_ex', 'repr', 'rmul', 'rpow', 'rshift', 'rsub', 'rtruediv', 'setattr', 'setitem', 'setstate', 'sizeof', 'str', 'sub', 'subclasshook', 'truediv', 'weakref', 'xor', 'advanced_index_add', 'advanced_index_select', 'cdata', 'check_advanced_indexing', 'new_with_metadata_file', 'set_index', 'sparse_mask', 'torch', 'write_metadata', 'abs', 'abs', 'acos', 'acos', 'add', 'add', 'addbmm', 'addbmm', 'addcdiv', 'addcdiv', 'addcmul', 'addcmul', 'addmm', 'addmm', 'addmv', 'addmv', 'addr', 'addr', 'apply
', 'asin', 'asin
', 'atan', 'atan2', 'atan2
', 'atan
', 'baddbmm', 'baddbmm
', 'bernoulli', 'bernoulli
', 'bmm', 'btrifact', 'btrisolve', 'byte', 'cauchy
', 'ceil', 'ceil
', 'char', 'chunk', 'clamp', 'clamp
', 'clone', 'contiguous', 'copy
', 'cos', 'cos', 'cosh', 'cosh_', 'cpu', 'cross', 'cuda', 'cumprod', 'cumsum', 'data', 'data_ptr', 'diag', 'dim', 'dist', 'div', 'div_', 'dot', 'double', 'eig', 'element_size', 'eq', 'eq_', 'equal', 'erf', 'erf_', 'erfinv', 'erfinv_', 'exp', 'exp_', 'expand', 'expand_as', 'exponential_', 'fill_', 'float', 'floor', 'floor_', 'fmod', 'fmod_', 'frac', 'frac_', 'gather', 'ge', 'ge_', 'gels', 'geometric_', 'geqrf', 'ger', 'gesv', 'gt', 'gt_', 'half', 'histc', 'index', 'index_add_', 'index_copy_', 'index_fill_', 'index_select', 'int', 'inverse', 'is_contiguous', 'is_cuda', 'is_pinned', 'is_same_size', 'is_set_to', 'is_shared', 'is_signed', 'is_sparse', 'kthvalue', 'le', 'le_', 'lerp', 'lerp_', 'lgamma', 'lgamma_', 'log', 'log1p', 'log1p_', 'log_', 'log_normal_', 'long', 'lt', 'lt_', 'map2_', 'map_', 'masked_copy_', 'masked_fill_', 'masked_scatter_', 'masked_select', 'matmul', 'max', 'mean', 'median', 'min', 'mm', 'mode', 'mul', 'mul_', 'multinomial', 'mv', 'narrow', 'ndimension', 'ne', 'ne_', 'neg', 'neg_', 'nelement', 'new', 'nonzero', 'norm', 'normal_', 'numel', 'numpy', 'orgqr', 'ormqr', 'permute', 'pin_memory', 'potrf', 'potri', 'potrs', 'pow', 'pow_', 'prod', 'pstrf', 'put_', 'qr', 'random_', 'reciprocal', 'reciprocal_', 'remainder', 'remainder_', 'renorm', 'renorm_', 'repeat', 'resize_', 'resize_as_', 'round', 'round_', 'rsqrt', 'rsqrt_', 'scatter_', 'scatter_add_', 'select', 'set_', 'shape', 'share_memory_', 'short', 'sigmoid', 'sigmoid_', 'sign', 'sign_', 'sin', 'sin_', 'sinh', 'sinh_', 'size', 'sort', 'split', 'sqrt', 'sqrt_', 'squeeze', 'squeeze_', 'std', 'storage', 'storage_offset', 'storage_type', 'stride', 'sub', 'sub_', 'sum', 'svd', 'symeig', 't', 't_', 'take', 'tan', 'tan_', 'tanh', 'tanh_', 'tolist', 'topk', 'trace', 'transpose', 'transpose_', 'tril', 'tril_', 'triu', 'triu_', 'trtrs', 'trunc', 'trunc_', 'type', 'type_as', 'unfold', 'uniform_', 'unsqueeze', 'unsqueeze_', 'var', 'view', 'view_as', 'zero_']
Recover the 3D models
cd ../bin; ./TestBump -batch ../data/robert//imList.txt ../data/robert//3D/ ../data/robert//shape ../data/robert//bump ../data/robert//bump ../3DMM_model/BaselFaceModel_mod.h5 ../dlib_model/shape_predictor_68_face_landmarks.dat ../data/robert//imgs; cd ../demoCode
load ../3DMM_model/BaselFaceModel_mod.h5
Process ../data/robert//imgs/test3dfacedetection.png
Process
sh: line 1: 23333 Segmentation fault ./TestBump -batch ../data/robert//imList.txt ../data/robert//3D/ ../data/robert//shape ../data/robert//bump ../data/robert//bump ../3DMM_model/BaselFaceModel_mod.h5 ../dlib_model/shape_predictor_68_face_landmarks.dat ../data/robert//imgs
Segmentation fault

注:尽管bash命令报错 Segmentation fault,需要的ply文件还是生成了。

你可能感兴趣的:(2018-01-24 修改py文件解决了人脸识别模型生成中需要显卡的问题)