ShahiraAbousamra / TopoCount

14 stars 5 forks source link

pytorch does not have version 0.5.0a0, and opencv does not have version 4.1.0 #1

Closed jieruyao49 closed 3 years ago

jieruyao49 commented 3 years ago

In readme's requirements, pytorch does not have version 0.5.0a0, and opencv does not have version 4.1.0. What version should be installed?

ShahiraAbousamra commented 3 years ago

Hi, Thank you for your interest.

First, I want to clarify that the versions listed were obtained by querying the libraries' __version__ method.

For the pytorch version I was using nvidia pytorch docker version 18.09. In the documentation they mention "PyTorch container image version 18.09 is based on PyTorch 0.4.1+." So you can use pytorch version 0.4.1. I also believe that pytorch version v1.0.0 will probably work as well.

For opencv, it was installed using: pip install opencv-python There is a version 4.1.0. The current version is 4.5.x. We are using basic functionality from opencv. You can try to install the closest version you can and the methods signature shouldn't have much differences, if any.

I hope this helps. I will try to push a docker to docker hub with the environment set up. When I do I will post in this thread.

jieruyao49 commented 3 years ago

Hi, Thank you for your interest.

First, I want to clarify that the versions listed were obtained by querying the libraries' version method.

For the pytorch version I was using nvidia pytorch docker version 18.09. In the documentation they mention "PyTorch container image version 18.09 is based on PyTorch 0.4.1+." So you can use pytorch version 0.4.1. I also believe that pytorch version v1.0.0 will probably work as well.

For opencv, it was installed using: pip install opencv-python There is a version 4.1.0. The current version is 4.5.x. We are using basic functionality from opencv. You can try to install the closest version you can and the methods signature shouldn't have much differences, if any.

I hope this helps. I will try to push a docker to docker hub with the environment set up. When I do I will post in this thread.

Thank you for your reply. I installed the following packages in Anaconda's environment:

Python 3.6.5
PyTorch 0.4.1
Numpy 1.15.1
Scipy 1.1.0
scikit-image 0.15.0
Pillow 6.1.0
OpenCV 4.5.1
tqdm 4.25.0
Matplotlib 2.2.3

When I run 2_ train.py The error is as follows:

Traceback (most recent call last):
  File "/home/ad/PycharmProjects/crowd/TopoCount-master/2_train.py", line 277, in <module>
    for i,(img,gt_dmap, gt_dots) in enumerate(tqdm(train_loader)):
  File "/home/ad/anaconda3/envs/topo_pytorch/lib/python3.6/site-packages/tqdm/_tqdm.py", line 933, in __iter__
    for obj in iterable:
  File "/home/ad/anaconda3/envs/topo_pytorch/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 314, in __next__
    batch = self.collate_fn([self.dataset[i] for i in indices])
  File "/home/ad/anaconda3/envs/topo_pytorch/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 314, in <listcomp>
    batch = self.collate_fn([self.dataset[i] for i in indices])
  File "/home/ad/PycharmProjects/crowd/TopoCount-master/my_dataset_train.py", line 116, in __getitem__
    i, j, h, w = transforms.RandomCrop.get_params(img_pil, output_size=(min(self.fixed_size,img.shape[0]), min(self.fixed_size,img.shape[1])))
AttributeError: type object 'RandomCrop' has no attribute 'get_params'
jieruyao49 commented 3 years ago

Hi, Thank you for your interest. First, I want to clarify that the versions listed were obtained by querying the libraries' version method. For the pytorch version I was using nvidia pytorch docker version 18.09. In the documentation they mention "PyTorch container image version 18.09 is based on PyTorch 0.4.1+." So you can use pytorch version 0.4.1. I also believe that pytorch version v1.0.0 will probably work as well. For opencv, it was installed using: pip install opencv-python There is a version 4.1.0. The current version is 4.5.x. We are using basic functionality from opencv. You can try to install the closest version you can and the methods signature shouldn't have much differences, if any. I hope this helps. I will try to push a docker to docker hub with the environment set up. When I do I will post in this thread.

Thank you for your reply. I installed the following packages in Anaconda's environment:

Python 3.6.5
PyTorch 0.4.1
Numpy 1.15.1
Scipy 1.1.0
scikit-image 0.15.0
Pillow 6.1.0
OpenCV 4.5.1
tqdm 4.25.0
Matplotlib 2.2.3

When I run 2_ train.py The error is as follows:

Traceback (most recent call last):
  File "/home/ad/PycharmProjects/crowd/TopoCount-master/2_train.py", line 277, in <module>
    for i,(img,gt_dmap, gt_dots) in enumerate(tqdm(train_loader)):
  File "/home/ad/anaconda3/envs/topo_pytorch/lib/python3.6/site-packages/tqdm/_tqdm.py", line 933, in __iter__
    for obj in iterable:
  File "/home/ad/anaconda3/envs/topo_pytorch/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 314, in __next__
    batch = self.collate_fn([self.dataset[i] for i in indices])
  File "/home/ad/anaconda3/envs/topo_pytorch/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 314, in <listcomp>
    batch = self.collate_fn([self.dataset[i] for i in indices])
  File "/home/ad/PycharmProjects/crowd/TopoCount-master/my_dataset_train.py", line 116, in __getitem__
    i, j, h, w = transforms.RandomCrop.get_params(img_pil, output_size=(min(self.fixed_size,img.shape[0]), min(self.fixed_size,img.shape[1])))
AttributeError: type object 'RandomCrop' has no attribute 'get_params'

When I upgraded the package: pyotch = 1.4.0, torch vision = 0.9.1, CUDA = 9.0, this bug was solved. I guess it's the torchvision version problem.