hukkelas / deep_privacy2

DeepPrivacy2 - A Toolbox for Realistic Image Anonymization
Apache License 2.0
292 stars 33 forks source link

ModuleNotFoundError: No module named 'tops' #11

Closed PaulSudarshan closed 1 year ago

PaulSudarshan commented 1 year ago

Getting the following error while executing the anonymize.py script.

Traceback (most recent call last): File "/content/deep_privacy2/anonymize.py", line 2, in import tops ModuleNotFoundError: No module named 'tops'

I have already browsed through the repository, but couldn't find any module called tops.

PedroKBrant commented 1 year ago

You can try this pip install git+https://github.com/hukkelas/torch_ops.git

PaulSudarshan commented 1 year ago

ModuleNotFoundError: No module named 'densepose'

from .cse import from_E_to_vertex File "/content/deep_privacy2/dp2/utils/cse.py", line 3, in from densepose.modeling.cse.utils import get_closest_vertices_mask_from_ES

there seems to be a missing module @PedroKBrant

hukkelas commented 1 year ago

It looks like you have not followed the installation instructions? The setup.py file should install all of these extensions.

See here for installation instructions

petale-azerty commented 1 year ago

ModuleNotFoundError: No module named 'densepose'

from .cse import from_E_to_vertex File "/content/deep_privacy2/dp2/utils/cse.py", line 3, in from densepose.modeling.cse.utils import get_closest_vertices_mask_from_ES

there seems to be a missing module @PedroKBrant

I have the problem, even if I use the setup.py file to install.

deep_privacy2-master/dp2/utils/cse.py", line 3, in from densepose.modeling.cse.utils import get_closest_vertices_mask_from_ES ModuleNotFoundError: No module named 'densepose'

Can you please help us ?

hukkelas commented 1 year ago

Can you show the output of pip list after running pip install git+https://github.com/hukkelas/torch_ops.git?

If densepose is in the list, please show the complete command you use to get the error above and report the complete error message.

petale-azerty commented 1 year ago

Hey, thank you for your reactivity. After did the pip install git+https://github.com/hukkelas/torch_ops.git here is the pip list (i just show you the list from letter D because it's long).

Cython 3.0.0b2 debugpy 1.5.1 decorator 5.1.1 DeepPrivacy 0.1.0 defusedxml 0.7.1 detectron2 0.6 distlib 0.3.6 djitellopy 1.5 dp2 0.1.0 easydict

As you see, there is no densepose.

hukkelas commented 1 year ago

That's strange. Could you try to install densepose alone?

pip install git+https://github.com/facebookresearch/detectron2@96c752ce821a3340e27edd51c28a00665dd32a30#subdirectory=projects/DensePose
petale-azerty commented 1 year ago

Damn, this is the issue.

First of all : do you think i should install the one who're not installed, manually ?

Successfully built detectron2-densepose Installing collected packages: av, detectron2-densepose ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. dp2 0.1.0 requires einops, which is not installed. dp2 0.1.0 requires einops_exts, which is not installed. dp2 0.1.0 requires fast_pytorch_kmeans, which is not installed. dp2 0.1.0 requires motpy@ git+https://github.com/wmuron/motpy@c77f85d27e371c0a298e9a88ca99292d9b9cbe6b, which is not installed. dp2 0.1.0 requires ninja==1.10.2, which is not installed. dp2 0.1.0 requires pyspng, which is not installed. dp2 0.1.0 requires regex, which is not installed. dp2 0.1.0 requires resize_right==0.0.2, which is not installed. dp2 0.1.0 requires torch_fidelity==0.3.0, which is not installed. dp2 0.1.0 requires wandb, which is not installed. dp2 0.1.0 requires imageio==2.4.1, but you have imageio 2.25.0 which is incompatible. dp2 0.1.0 requires pillow==8.3.1, but you have pillow 9.4.0 which is incompatible. dp2 0.1.0 requires scipy==1.7.1, but you have scipy 1.10.0 which is incompatible. dp2 0.1.0 requires setuptools==59.5.0, but you have setuptools 65.6.3 which is incompatible. Successfully installed av-10.0.0 detectron2-densepose-0.6

Then when i do :

python3 anonymize.py configs/anonymizers/FB_cse.py --webcam

Here is the answer :

ImportError: dlopen(/Users/mmm24/miniconda3/lib/python3.9/site-packages/pycocotools/_mask.cpython-39-darwin.so, 0x0002): tried: '/Users/mmm24/miniconda3/lib/python3.9/site-packages/pycocotools/_mask.cpython-39-darwin.so' (mach-o file, but is an incompatible architecture (have (x86_64), need (arm64e)))

hukkelas commented 1 year ago

First of all : do you think i should install the one who're not installed, manually ?

That can help debug your issue at least.

Are you trying to install this on an arm CPU? If so, a mac?

petale-azerty commented 1 year ago

First of all : do you think i should install the one who're not installed, manually ?

That can help debug your issue at least.

Are you trying to install this on an arm CPU? If so, a mac?

Yes I do. Is this the problem ? Because it works with the deepPrivacy (1) that you made

hukkelas commented 1 year ago

Last time I installed detectron2 for arm-based Mac it was not that straightforward. Could you try to install everything from scratch in a new conda environment? First install pytorch and detectron2 following this tutorial that I tested with my own m1 mac. Then, install deep privacy 2 with:

pip install git+https://github.com/hukkelas/deep_privacy2.git
petale-azerty commented 1 year ago

Well, after few hours of trying it still not working.

I still don't know what to do haha...

petale-azerty commented 1 year ago

Ohhhhhh it finally works. I just had to install few others packages, but now it's okay. Thank a lot for your help, now let's have some fun ! ☺︎

petale-azerty commented 1 year ago

Ok, I'm sorry, just an other one now :

hukkelas commented 1 year ago

why is the frame so slow with the webcam ? How can we change it ?

Because the webcam FPS follows the number of frames the anonymization inference uses. On an RTX 3090 I achieve roughly 5-10 FPS for a single person in the image.

It is possible to wastly improve inference time if you optimize the current code further, but this is something I currently do not have time to do.

hukkelas commented 1 year ago

Closing this issue for now. Reopen if you have further issues.