Apress / computer-vision-projects-with-pytorch

Source Code for "Computer Vision Projects with PyTorch" by Akshay Kulkarni, Adarsha Shivananda, and Nitin Ranjan Sharma
25 stars 17 forks source link

Error in chapter 4 #1

Open andysingal opened 1 year ago

andysingal commented 1 year ago

Hi, While running:

## clone the pytorch repository to setup exact directory structures as the original trained
!git clone https://github.com/pytorch/vision.git
%cd vision
!git checkout v0.3.0

!cp references/detection/engine.py ../
!cp references/detection/transforms.py ../
!cp references/detection/utils.py ../
!cp references/detection/coco_utils.py ../
!cp references/detection/coco_eval.py ../
   ## imports from the pytorch repo

import utils import transforms as T from engine import train_one_epoch, evaluate

i am getting error:

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
[<ipython-input-10-a6f039a61dde>](https://localhost:8080/#) in <cell line: 3>()
      1 ## imports from the pytorch repo
      2 from torch import inf
----> 3 from engine import train_one_epoch, evaluate
      4 import utils
      5 import transforms as T

1 frames
[/content/coco_eval.py](https://localhost:8080/#) in <module>
      6 import time
      7 import torch
----> 8 import torch._six
      9 
     10 from pycocotools.cocoeval import COCOeval

ModuleNotFoundError: No module named 'torch._six'


NOTE: If your import is failing due to a missing package, you can manually install dependencies using either !pip or !apt.

To view examples of installing some common dependencies, click the "Open Examples" button below.

nitinranjansharma commented 1 year ago

Hi , they seem to have removed the module , please refer to this. - https://github.com/pytorch/pytorch/pull/94709. The error seems to have come from "evaluate". The evaluate module from engine can be replaced by model eval or any other custom evaluation method. Let me know if this helps.

andysingal commented 1 year ago

ate module from engine can be replaced by model

Got it, is it possible you can fix the code on your git repo to make it easier. Thanks