Do we really need opencv if using pytorch?

I have opencv running in the same virtual environment in which I installed pytorch from source. However, when compiling pytorch I saw a warning (not an error):

“Excluding image processing operators due to no opencv”

Thank You
Tom

Thank You
Tom

pytorch itself uses the PIL however I recommend to install opencv. It is easy to use and there are various function which is helpful for data augmentation

1 Like

Thank you so much for your reply.

Yes, I use OpenCV and it is running in the same virtual environment. However, I do get a message while compiling pytorch

-- Excluding image processing operators due to no opencv
-- Excluding video processing operators due to no opencv

In a terminal, I can run

>>> import torch
>>> import cv2

What is the difference between compiling OpenCV with torch or separately?

Thank You

Some of pip or conda opencv does not include the some of function because of the license or patent issue or cmake flag.
I usually use the below link for opencv python.
https://github.com/conda-forge/opencv-feedstock.
I also use the miniconda system so it doesn not include large space in your storage.

1 Like

It entirely depends on the user. Most of the PyTorch transformations are performed on PIL images. You can convert from PIL to Tensor and vice verse and same with PIL to numpy.

1 Like