Pytorch error in scale_box
Search before asking
-
I have searched the YOLOv5 issues and discussions and found no similar questions.
Question
I have code that uses yolov5 for detection, I use it on mutiple machines and it works on most of them this is the code that uses it
# logger.info("in_cam -- face detection end")
for i, det in enumerate(results.xyxy):
logger.info("detections have been detected")
print(det[:, :4])
img1shape = frame.shape[0:2]
detected_coordinates = det[:, :4]
img0shape = frame.shape
detected_coordinates = scale_boxes(img1shape, detected_coordinates, img0shape).round()
xywhs = xyxy2xywh(det[:, 0:4])
confs = detected_coordinates
clss = detected_coordinates
on this machine it gives me this errors:
File "/path_to_project/in_cam_code.py", line 721, in in_process
detected_coordinates = scale_boxes(img1shape, detected_coordinates, img0shape).round()
File "/path_to_project/yolov5/utils/general.py", line 781, in scale_boxes
boxes[:, [0, 2]] -= pad[0] # x padding
RuntimeError: Inplace update to inference tensor outside InferenceMode is not allowed.You can make a clone to get a normal tensor before doing inplace update.See https://github.com/pytorch/rfcs/pull/17 for more details.
I think it might be an environment issue I did install the requirements.txt I tried updating the repo then reinstalling, still the same issue I'm not sure which library version might lead to this here's my pip list result just in case
(tfremake) mai@mai-ThinkPad-E15-Gen-2:~$ pip list
Package Version
----------------------------- --------------------
absl-py 1.2.0
argon2-cffi 21.3.0
argon2-cffi-bindings 21.2.0
asttokens 2.0.8
astunparse 1.6.3
attrs 22.1.0
backcall 0.2.0
backports.functools-lru-cache 1.6.4
beautifulsoup4 4.11.1
bleach 5.0.1
Bottleneck 1.3.5
cachetools 5.2.0
certifi 2022.9.24
cffi 1.15.1
charset-normalizer 2.1.1
click 8.1.3
cycler 0.11.0
debugpy 1.6.3
decorator 5.1.1
defusedxml 0.7.1
dlib 19.24.0
easydict 1.9
entrypoints 0.4
executing 1.1.0
face-recognition 1.3.0
face-recognition-models 0.3.0
fastjsonschema 2.16.2
filelock 3.8.0
fire 0.4.0
Flask 2.2.2
flatbuffers 2.0.7
flit_core 3.7.1
fonttools 4.25.0
gast 0.4.0
gdown 4.5.1
google-auth 2.11.1
google-auth-oauthlib 0.4.6
google-pasta 0.2.0
grpcio 1.49.1
h5py 3.7.0
idna 3.4
importlib-metadata 4.11.4
importlib-resources 5.9.0
ipykernel 6.16.0
ipython 8.5.0
ipython-genutils 0.2.0
itsdangerous 2.1.2
jedi 0.18.1
Jinja2 3.1.2
joblib 1.2.0
jsonschema 4.16.0
jupyter_client 7.3.5
jupyter_core 4.11.1
jupyterlab-pygments 0.2.2
keras 2.8.0
Keras-Preprocessing 1.1.2
kiwisolver 1.4.2
libclang 14.0.6
lightgbm 3.3.2
lxml 4.9.1
Markdown 3.4.1
MarkupSafe 2.1.1
matplotlib 3.5.2
matplotlib-inline 0.1.6
mediapipe 0.8.11
mistune 2.0.4
mtcnn 0.1.1
munkres 1.1.4
nb-conda 2.2.1
nb-conda-kernels 2.3.1
nbclient 0.6.8
nbconvert 7.0.0
nbformat 5.6.1
nest-asyncio 1.5.5
notebook 6.4.12
numexpr 2.8.3
numpy 1.21.5
oauthlib 3.2.1
opencv-contrib-python 4.6.0.66
opencv-python 4.6.0.66
opt-einsum 3.3.0
packaging 21.3
pandas 1.4.4
pandocfilters 1.5.0
parso 0.8.3
pexpect 4.8.0
pickleshare 0.7.5
Pillow 9.2.0
pip 22.2.2
pkgutil_resolve_name 1.3.10
ply 3.11
prometheus-client 0.14.1
prompt-toolkit 3.0.31
protobuf 3.19.5
psutil 5.9.2
ptyprocess 0.7.0
pure-eval 0.2.2
pyasn1 0.4.8
pyasn1-modules 0.2.8
pycparser 2.21
Pygments 2.13.0
pyparsing 3.0.9
PyQt5-sip 12.11.0
pyrsistent 0.18.1
PySocks 1.7.1
python-dateutil 2.8.2
pytz 2022.2.1
PyYAML 6.0
pyzmq 24.0.1
requests 2.28.1
requests-oauthlib 1.3.1
retina-face 0.0.12
rsa 4.9
scikit-learn 1.1.2
scipy 1.7.3
seaborn 0.11.2
Send2Trash 1.8.0
setuptools 65.4.0
sip 6.6.2
six 1.16.0
soupsieve 2.3.2.post1
stack-data 0.5.1
tensorboard 2.8.0
tensorboard-data-server 0.6.1
tensorboard-plugin-wit 1.8.1
tensorflow 2.8.0
tensorflow-estimator 2.10.0
tensorflow-io-gcs-filesystem 0.27.0
termcolor 2.0.1
terminado 0.15.0
tf-estimator-nightly 2.8.0.dev2021122109
thop 0.1.1.post2209072238
threadpoolctl 3.1.0
tinycss2 1.1.1
toml 0.10.2
torch 1.10.1+cpu
torchaudio 0.10.1+rocm4.1
torchvision 0.11.2+cpu
tornado 6.2
tqdm 4.64.0
traitlets 5.4.0
typing_extensions 4.3.0
urllib3 1.26.12
wcwidth 0.2.5
webencodings 0.5.1
Werkzeug 2.2.2
wheel 0.37.1
wrapt 1.14.1
zipp 3.8.1
Additional
No response