Jetson Orin部署yolo5-6.1---AttributeError:‘Upsample‘ object has no attribute ‘recompute_scale_factor‘

 YOLO5使用手册YOLOv5 文档 (ultralytics.com)

orin的性能肉眼可见附上一张tx2_nx的图先Jetson Orin部署yolo5-6.1---AttributeError:‘Upsample‘ object has no attribute ‘recompute_scale_factor‘_第1张图片 

已经卡死了,买TX2_NX的小伙伴只能代码上努努力了 

还得

sudo fallocate -l 64G /swapfile
  196  sudo chmod 600 /swapfile
  197  sudo mkswap /swapfile
  198  sudo swapon /swapfile
  199  free -h
  200  df -h
  201  sudo bash -c 'echo"/swapfile swap swap defaults 0 0" >> /etc/fstab'
  202  sudo bash -c 'echo "/swapfile swap swap defaults 0 0" >> /etc/fstab'
  203  cat /etc/fstab
  204  history

增加交换空间

YOLO是“你只看一次”的首字母缩写,是一种将图像划分为网格系统的对象检测算法。网格中的每个单元负责检测其内部的对象。

YOLO 因其速度和准确性而成为最著名的对象检测算法之一

 

nvidia@nvidia-desktop:~/yolov5-6.1$ python3 detect.py --weights yolov5s.pt --source data/images/bus.jpg
detect: weights=['yolov5s.pt'], source=data/images/bus.jpg, data=data/coco128.yaml, imgsz=[640, 640], conf_thres=0.25, iou_thres=0.45, max_det=1000, device=, view_img=False, save_txt=False, e_conf=False, save_crop=False, nosave=False, classes=None, agnostic_nms=False, augment=False, visualize=False, update=False, project=runs/detect, name=exp, exist_ok=False, line_thickness=3, e_labels=False, hide_conf=False, half=False, dnn=False
YOLOv5  2022-2-22 torch 1.12.0a0+2c916ef.nv22.3 CUDA:0 (Orin, 30537MiB)

Fusing layers...
Model Summary: 224 layers, 7266973 parameters, 0 gradients
Traceback (most recent call last):
  File "detect.py", line 257, in 
    main(opt)
  File "detect.py", line 252, in main
    run(**vars(opt))
  File "/home/nvidia/.local/lib/python3.8/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context
    return func(*args, **kwargs)
  File "detect.py", line 113, in run
    model.warmup(imgsz=(1 if pt else bs, 3, *imgsz), half=half)  # warmup
  File "/home/nvidia/yolov5-6.1/models/common.py", line 463, in warmup
    self.forward(im)  # warmup
  File "/home/nvidia/yolov5-6.1/models/common.py", line 402, in forward
    y = self.model(im) if self.jit else self.model(im, augment=augment, visualize=visualize)
  File "/home/nvidia/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1111, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/nvidia/yolov5-6.1/models/yolo.py", line 126, in forward
    return self._forward_once(x, profile, visualize)  # single-scale inference, train
  File "/home/nvidia/yolov5-6.1/models/yolo.py", line 149, in _forward_once
    x = m(x)  # run
  File "/home/nvidia/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1111, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/nvidia/.local/lib/python3.8/site-packages/torch/nn/modules/upsampling.py", line 154, in forward
    recompute_scale_factor=self.recompute_scale_factor)
  File "/home/nvidia/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1186, in __getattr__
    raise AttributeError("'{}' object has no attribute '{}'".format(
AttributeError: 'Upsample' object has no attribute 'recompute_scale_factor'
nvidia@nvidia-desktop:~/yolov5-6.1$ sudo vi /home/nvidia/.local/lib/python3.8/site-packages/torch/nn/modules/upsampling.py
[sudo] password for nvidia:
nvidia@nvidia-desktop:~/yolov5-6.1$ sudo vi /home/nvidia/.local/lib/python3.8/site-packages/torch/nn/modules/upsampling.py
nvidia@nvidia-desktop:~/yolov5-6.1$ python3 detect.py --weights yolov5s.pt --source data/images/bus.                                                                                          jpg
detect: weights=['yolov5s.pt'], source=data/images/bus.jpg, data=data/coco128.yaml, imgsz=[640, 640], conf_thres=0.25, iou_thres=0.45, max_det=1000, device=, view_img=False, save_txt=False, e_conf=False, save_crop=False, nosave=False, classes=None, agnostic_nms=False, augment=False, visualize=False, update=False, project=runs/detect, name=exp, exist_ok=False, line_thickness=3, e_labels=False, hide_conf=False, half=False, dnn=False
YOLOv5  2022-2-22 torch 1.12.0a0+2c916ef.nv22.3 CUDA:0 (Orin, 30537MiB)

Fusing layers...
Model Summary: 224 layers, 7266973 parameters, 0 gradients
Traceback (most recent call last):
  File "detect.py", line 257, in 
    main(opt)
  File "detect.py", line 252, in main
    run(**vars(opt))
  File "/home/nvidia/.local/lib/python3.8/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context
    return func(*args, **kwargs)
  File "detect.py", line 113, in run
    model.warmup(imgsz=(1 if pt else bs, 3, *imgsz), half=half)  # warmup
  File "/home/nvidia/yolov5-6.1/models/common.py", line 463, in warmup
    self.forward(im)  # warmup
  File "/home/nvidia/yolov5-6.1/models/common.py", line 402, in forward
    y = self.model(im) if self.jit else self.model(im, augment=augment, visualize=visualize)
  File "/home/nvidia/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1111, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/nvidia/yolov5-6.1/models/yolo.py", line 126, in forward
    return self._forward_once(x, profile, visualize)  # single-scale inference, train
  File "/home/nvidia/yolov5-6.1/models/yolo.py", line 149, in _forward_once
    x = m(x)  # run
  File "/home/nvidia/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1111, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/nvidia/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 202, in _forward_unimplemented
    raise NotImplementedError
NotImplementedError
nvidia@nvidia-desktop:~/yolov5-6.1$ sudo vi /home/nvidia/.local/lib/python3.8/site-packages/torch/nn/modules/upsampling.py
nvidia@nvidia-desktop:~/yolov5-6.1$ python3 detect.py --weights yolov5s.pt --source data/images/bus.jpg
detect: weights=['yolov5s.pt'], source=data/images/bus.jpg, data=data/coco128.yaml, imgsz=[640, 640], conf_thres=0.25, iou_thres=0.45, max_det=1000, device=, view_img=False, save_txt=False, e_conf=False, save_crop=False, nosave=False, classes=None, agnostic_nms=False, augment=False, visualize=False, update=False, project=runs/detect, name=exp, exist_ok=False, line_thickness=3, e_labels=False, hide_conf=False, half=False, dnn=False
YOLOv5  2022-2-22 torch 1.12.0a0+2c916ef.nv22.3 CUDA:0 (Orin, 30537MiB)

Fusing layers...
Model Summary: 224 layers, 7266973 parameters, 0 gradients
image 1/1 /home/nvidia/yolov5-6.1/data/images/bus.jpg: 640x480 4 persons, 1 bus, 1 fire hydrant, Done. (0.031s)
Speed: 2.3ms pre-process, 30.6ms inference, 4.4ms NMS per image at shape (1, 3, 640, 640)
Results saved to runs/detect/exp3
nvidia@nvidia-desktop:~/yolov5-6.1$ ls
CONTRIBUTING.md  detect.py   export.py   LICENSE  __pycache__  requirements.txt  setup.cfg  tutorial.ipynb  val.py
data             Dockerfile  hubconf.py  models   README.md    runs              train.py   utils           yolov5s.pt
nvidia@nvidia-desktop:~/yolov5-6.1$ sudo vi /home/nvidia/.local/lib/python3.8/site-packages/torch/nn/modules/upsampling.py
nvidia@nvidia-desktop:~/yolov5-6.1$ ls
CONTRIBUTING.md  detect.py   export.py   LICENSE  __pycache__  requirements.txt  setup.cfg  tutorial.ipynb  val.py
data             Dockerfile  hubconf.py  models   README.md    runs              train.py   utils           yolov5s.pt
nvidia@nvidia-desktop:~/yolov5-6.1$ cd runs/detect/exp
exp/  exp2/ exp3/
nvidia@nvidia-desktop:~/yolov5-6.1$ cd runs/detect/exp
exp/  exp2/ exp3/
nvidia@nvidia-desktop:~/yolov5-6.1$ cd runs/detect/exp3/
nvidia@nvidia-desktop:~/yolov5-6.1/runs/detect/exp3$ ls
bus.jpg

视频效果如下

 Jetson Orin部署yolo5-6.1---AttributeError:‘Upsample‘ object has no attribute ‘recompute_scale_factor‘_第2张图片

Jetson Orin部署yolo5-6.1---AttributeError:‘Upsample‘ object has no attribute ‘recompute_scale_factor‘_第3张图片

Jetson Orin部署yolo5-6.1---AttributeError:‘Upsample‘ object has no attribute ‘recompute_scale_factor‘_第4张图片

 Jetson Orin部署yolo5-6.1---AttributeError:‘Upsample‘ object has no attribute ‘recompute_scale_factor‘_第5张图片

Jetson Orin部署yolo5-6.1---AttributeError:‘Upsample‘ object has no attribute ‘recompute_scale_factor‘_第6张图片

 Jetson Orin部署yolo5-6.1---AttributeError:‘Upsample‘ object has no attribute ‘recompute_scale_factor‘_第7张图片

 Jetson Orin部署yolo5-6.1---AttributeError:‘Upsample‘ object has no attribute ‘recompute_scale_factor‘_第8张图片

 Jetson Orin部署yolo5-6.1---AttributeError:‘Upsample‘ object has no attribute ‘recompute_scale_factor‘_第9张图片

 Jetson Orin部署yolo5-6.1---AttributeError:‘Upsample‘ object has no attribute ‘recompute_scale_factor‘_第10张图片

你可能感兴趣的:(nvidia,torch,深度学习,人工智能,自然语言处理)