SilvesterYu / Chat

Collection of hacks and resources
1 stars 1 forks source link

YOLO COMMANDS #18

Open SilvesterYu opened 2 years ago

SilvesterYu commented 2 years ago

To work in local environment, log into root, then use

source yolo_env/bin/activate

then cd into yolo_env/yolov5

cd  yolo_env/yolov5

Image view

 tiv Best-farm-animals-cow.jpg
SilvesterYu commented 2 years ago

To detect an image, first, go on the internet and find a good lookin' image. Copy the URL. Then use wget to download

 wget "https://a-z-animals.com/media/2021/12/Best-farm-animals-cow.jpg"

Then, run yolo detection with

 python3 detect.py --weights yolov5s.pt --img 640 --conf 0.25 --source 'Best-farm-animals-cow.jpg' --save-txt

Afterwards, YOLO will tell you where the image is saved. It is usually in the path like runs/detect/exp5

Mark this folder, then display the image using (Make sure path is correct)

tiv runs/detect/exp3/Best-farm-animals-cow.jpg
SilvesterYu commented 2 years ago

The magic used is to downgrade the YOLO from GPU to CPU using

 pip3 install torch==1.8.2+cpu torchvision==0.9.2+cpu torchaudio==0.8.2 -f https://download.pytorch.org/whl/lts/1.8/torch_lts.html

Also, Terminal Image Viewer tiv is handy. I might later want to look into how to transfer files from ssh to my computer.

SilvesterYu commented 2 years ago

Terminal image viewer: https://github.com/stefanhaustein/TerminalImageViewer

SilvesterYu commented 2 years ago

allow write:

sudo chmod -R 777 *.*
sudo -s
wget "...."

And re-activate the environment outside of yolo_env