-
Notifications
You must be signed in to change notification settings - Fork 7.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix DensePose vertex visualization. #5278
base: main
Are you sure you want to change the base?
Conversation
Fix a RuntimeError by explicitly copying an index array to the CPU.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this change not effect when the closest_vertices
are stored in the GPU..?
I think I tested this change with the GPU (I'm running an Nvidia GPU on my Linux machine), but I'm not sure, I'm really not an expert of Pytorch etc. Do you have a suggestion on how can I force the script to run with a GPU? (Even though I think it was already, since the CPU load was low enough and the GPU was actually making noise). |
So you could use something like |
Ok, I tried to revert my patch and added print("Is CUDA available?", torch.cuda.is_available()) Result:
The script doesn't run without CUDA at all: CUDA_VISIBLE_DEVICES="" python apply_net.py show configs/cse/densepose_rcnn_R_50_FPN_s1x.yaml https://dl.fbaipublicfiles.com/densepose/cse/densepose_rcnn_R_50_FPN_s1x/251155172/model_final_c4ea5f.pkl ../rgb_00000.jpg --output .../out.png dp_vertex,bbox -v
Have you tried to run the command I wrote? |
Hi, |
Would it though? |
By ensuring closest_vertices is on the same device as embed_map, you avoid the RuntimeError without compromising performance significantly. This approach provides a balanced solution, maintaining the efficiency of GPU operations during inference while ensuring compatibility and simplicity during visualization. |
print(embed_map.device) --> |
From what I can see, I'm not going to do any refactors to make sure |
@PieroV, Best regards, |
The problem is actually in the |
This commit fixes a RuntimeError by explicitly copying an index array to the CPU:
My command line was: