from lib.colab_util import generate_video_from_obj, set_renderer, video
renderer = set_renderer()
generate_video_from_obj(obj_path, out_img_path, video_path, renderer)
# we cannot play a mp4 video generated by cv2
!ffmpeg -i $video_path -vcodec libx264 $video_display_path -y -loglevel quiet
video(video_display_path)
result:
0%
0/90 [00:00<?, ?it/s]
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-35-22614b7ef849> in <module>
2
3 renderer = set_renderer()
----> 4 generate_video_from_obj(obj_path, out_img_path, video_path, renderer)
5
6 # we cannot play a mp4 video generated by cv2
~/Downloads/3Dmodel/pifuhd/lib/colab_util.py in generate_video_from_obj(obj_path, image_path, video_path, renderer)
127 # create VideoWriter
128 # print(':)')
--> 129 fourcc = cv2. VideoWriter_fourcc(*'MP4V')
130 out = cv2.VideoWriter(video_path, fourcc, 20.0, (1024,512))
131
~/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py in __call__(self, *input, **kwargs)
548 result = self._slow_forward(*input, **kwargs)
549 else:
--> 550 result = self.forward(*input, **kwargs)
551 for hook in self._forward_hooks.values():
552 hook_result = hook(self, input, result)
~/anaconda3/lib/python3.7/site-packages/pytorch3d/renderer/mesh/renderer.py in forward(self, meshes_world, **kwargs)
49 the range for the corresponding face.
50 """
---> 51 fragments = self.rasterizer(meshes_world, **kwargs)
52 raster_settings = kwargs.get("raster_settings", self.rasterizer.raster_settings)
53 if raster_settings.blur_radius > 0.0:
~/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py in __call__(self, *input, **kwargs)
548 result = self._slow_forward(*input, **kwargs)
549 else:
--> 550 result = self.forward(*input, **kwargs)
551 for hook in self._forward_hooks.values():
552 hook_result = hook(self, input, result)
~/anaconda3/lib/python3.7/site-packages/pytorch3d/renderer/mesh/rasterizer.py in forward(self, meshes_world, **kwargs)
126 max_faces_per_bin=raster_settings.max_faces_per_bin,
127 perspective_correct=raster_settings.perspective_correct,
--> 128 cull_backfaces=raster_settings.cull_backfaces,
129 )
130 return Fragments(
~/anaconda3/lib/python3.7/site-packages/pytorch3d/renderer/mesh/rasterize_meshes.py in rasterize_meshes(meshes, image_size, blur_radius, faces_per_pixel, bin_size, max_faces_per_bin, perspective_correct, cull_backfaces)
143 max_faces_per_bin,
144 perspective_correct,
--> 145 cull_backfaces,
146 )
147
~/anaconda3/lib/python3.7/site-packages/pytorch3d/renderer/mesh/rasterize_meshes.py in forward(ctx, face_verts, mesh_to_face_first_idx, num_faces_per_mesh, image_size, blur_radius, faces_per_pixel, bin_size, max_faces_per_bin, perspective_correct, cull_backfaces)
195 max_faces_per_bin,
196 perspective_correct,
--> 197 cull_backfaces,
198 )
199 ctx.save_for_backward(face_verts, pix_to_face)
RuntimeError: Not compiled with GPU support
but I try torch.cuda.is_available() is True
Can anybody help? Thanks
My guess is your pytorch3d is installed with pip. As far as I know, pip package is not built with GPU. If this is the case, you may try with conda package or build from source.
result:
but I try
torch.cuda.is_available()
is True Can anybody help? Thanks