Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After update cannot redirect output to file anymore. #5960

Closed
1 of 2 tasks
superalino opened this issue Dec 12, 2021 · 4 comments
Closed
1 of 2 tasks

After update cannot redirect output to file anymore. #5960

superalino opened this issue Dec 12, 2021 · 4 comments
Labels

Comments

@superalino
Copy link

Search before asking

  • I have searched the YOLOv5 issues and found no similar bug report.

YOLOv5 Component

Detection

Bug

After update I have noticed that detect.py behavior has changed

If I launch this command with latest version of yolov5:

python3 detect.py --weights weights/yolov5x6.pt --classes 0 --conf-thres 0.71 --img-size=1280 --source /archivio/Evento-1035663-VialeSilvia-00026-capture.jpg --project /dev/shm/test/ > /tmp/anal.log

The output file /tmp/anal.log is empty.

root@videosorveglianza:/scripts/yolov5_last# python3 detect.py --weights weights/yolov5x6.pt --classes 0 --conf-thres 0.71 --img-size=1280 --source /archivio/Evento-1035663-VialeSilvia-00026-capture.jpg --project /dev/shm/test/ > /tmp/anal.log
detect: weights=['weights/yolov5x6.pt'], source=/archivio/Evento-1035663-VialeSilvia-00026-capture.jpg, imgsz=[1280, 1280], conf_thres=0.71, iou_thres=0.45, max_det=1000, device=, view_img=False, save_txt=False, save_conf=False, save_crop=False, nosave=False, classes=[0], agnostic_nms=False, augment=False, visualize=False, update=False, project=/dev/shm/test/, name=exp, exist_ok=False, line_thickness=3, hide_labels=False, hide_conf=False, half=False, dnn=False
YOLOv5 🚀 v6.0-139-g8f35436 torch 1.10.0+cu102 CUDA:0 (NVIDIA GeForce GTX 1060 6GB, 6078MiB)

Fusing layers...
Model Summary: 574 layers, 140730220 parameters, 0 gradients
image 1/1 /archivio/Evento-1035663-VialeSilvia-00026-capture.jpg: 768x1280 Done. (0.168s)
Speed: 0.7ms pre-process, 168.2ms inference, 0.8ms NMS per image at shape (1, 3, 1280, 1280)
Results saved to /dev/shm/test/exp
root@videosorveglianza:/scripts/yolov5_last# ls -altr /tmp/anal.log
-rw-r--r-- 1 root root 0 12 dic 15.48 /tmp/anal.log

If I launch this command on version 6-0-35 output file has the output I need:

root@videosorveglianza:/scripts/yolov5_6# python3 detect.py --weights weights/yolov5x6.pt --classes 0 --conf-thres 0.71 --img-size=1280 --source /archivio/Evento-1035663-VialeSilvia-00026-capture.jpg --project /dev/shm/test/ > /tmp/anal.log
YOLOv5 🚀 v6.0-35-ga4fece8 torch 1.10.0+cu102 CUDA:0 (NVIDIA GeForce GTX 1060 6GB, 6077.9375MB)

Fusing layers...
/usr/local/lib/python3.9/dist-packages/torch/functional.py:445: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at ../aten/src/ATen/native/TensorShape.cpp:2157.)
return _VF.meshgrid(tensors, **kwargs) # type: ignore[attr-defined]
Model Summary: 574 layers, 140730220 parameters, 0 gradients

root@videosorveglianza:/scripts/yolov5_6# cat /tmp/anal.log
detect: weights=['weights/yolov5x6.pt'], source=/archivio/Evento-1035663-VialeSilvia-00026-capture.jpg, imgsz=[1280, 1280], conf_thres=0.71, iou_thres=0.45, max_det=1000, device=, view_img=False, save_txt=False, save_conf=False, save_crop=False, nosave=False, classes=[0], agnostic_nms=False, augment=False, visualize=False, update=False, project=/dev/shm/test/, name=exp, exist_ok=False, line_thickness=3, hide_labels=False, hide_conf=False, half=False, dnn=False
image 1/1 /archivio/Evento-1035663-VialeSilvia-00026-capture.jpg: 768x1280 Done. (0.268s)
Speed: 2.2ms pre-process, 267.7ms inference, 11.6ms NMS per image at shape (1, 3, 1280, 1280)
Results saved to /dev/shm/test/exp7

Environment

YOLOv5 🚀 v6.0-139-g8f35436 torch 1.10.0+cu102 CUDA:0 (NVIDIA GeForce GTX 1060 6GB, 6078MiB)
Debian 11
Python 3.9.2

Minimal Reproducible Example

python3 detect.py > /tmp/output.log

Additional

No response

Are you willing to submit a PR?

  • Yes I'd like to help by submitting a PR!
@superalino superalino added the bug Something isn't working label Dec 12, 2021
@glenn-jocher glenn-jocher removed the bug Something isn't working label Dec 12, 2021
@glenn-jocher
Copy link
Member

@superalino YOLOv5 has consolidated logging now using the LOGGER instance:

LOGGER = set_logging(__name__) # define globally (used in train.py, val.py, detect.py, etc.)

See #5569

@superalino
Copy link
Author

Ok, I'm not able to understand how it works so I did this stupid workaround:

detect.py >& output.log

@glenn-jocher
Copy link
Member

@superalino it works!

Why does adding the & work??

@github-actions
Copy link
Contributor

github-actions bot commented Jan 14, 2022

👋 Hello, this issue has been automatically marked as stale because it has not had recent activity. Please note it will be closed if no further activity occurs.

Access additional YOLOv5 🚀 resources:

Access additional Ultralytics ⚡ resources:

Feel free to inform us of any other issues you discover or feature requests that come to mind in the future. Pull Requests (PRs) are also always welcomed!

Thank you for your contributions to YOLOv5 🚀 and Vision AI ⭐!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants