Skip to content

ereedsanchez/Forest-Buddy-Server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Forest-Buddy-Server

Forest Buddy Server

Forest Buddy Install

Prerequisites

  • Windows 10 | Windows 11
  • Intel/AMD Processors [Has not been tested on the M1 Chipset]
  • Nvidia 20 series GPU and above

Install

Make sure to download the following softwares in the order listed.

1. Visual Studio Community Edition

Link

Download should appear in Downloads list. Run file. Click on Individual Components tab and scroll down to Compiler s, build tools, and runtimes.

Scroll down the list and tick only the boxes starting with C++ ie. (C++ 2022 Redistributable MSMs, C++ 2022 Redistributable Update)

Make sure to not tick the boxes of the packages labeled [Deprecated, Out of Support]

Install > Continue

2. Nvidia Nsight Visual Studio Edition

Link

Nvidia Developer Account may be necessary

Upon installation, next > Confirm you want the packages to install and press next until you see Install. Click install.

3. Anaconda

Link

Run the installer and press Next and be sure to Agree to Terms of Service.

Click Just for Me

In Advanced Installation Option be sure to have checked

  • Add Anaconda to my PATH Environment variable
  • Register Anadconda as my default Python

Install

4. CUDA Toolkit 12.1

Link

We choose CUDA 12.1 because it is supported by the latest stable version of PyTORCH (2.3.1)

Choose appropriate options for Target Platform to download

  • ie. Windows, x86_64, Windows 10/11, exe (local)

Run installer > Agree and Continue > Custom(Advanced) > Make sure that ONLY CUDA is ticked. > Next

5. cuDNN

Link

Nvidia Developer Account may be necessary

Make sure to choose the appropriate version. We are using the Cuda 12.1 So choose the first for CUDA 12.x

Download Local Installer for Windows(Zip)

Your download should have a name similar to cudnn-windows-x86_64-8.9.7.29_cuda12-archive.zip > Open > Click on lib > x64

On your machine: Open Explorer > Local Disk > Program Files > Nvidia GPU Computing Toolkit > CUDA > v12.1

From the downloaded cuDNN archive go into x64 and copy the contents inside that folder and transfer them over to the corresponding folder on your machine. Lib > x64

Do the same with files from the include and bin folders

6. Pytorch

Link

Make sure to choose Appropriately for the system configured.

Here we are using

  • Stable(2.3.1)
  • Windows
  • Conda
  • Python
  • Cuda 12.1

It should give you a command similar to :

conda install pytorch torchvision torchaudio pytorch-cuda=12.1 -c pytorch -c nvidia

Open up start menu and go to anaconda prompt and input this command to install

Verify torch/cuda version

python

import torch
torch.__version__
torch.cuda.is_available()

To exit:

exit()

7. Ultralytics

For good practice, in the name of tidiness, make a directory for each of your projects that contain all its respective files.
I will create a folder called yolov8 in my C:\Users\YourName\ Directory and i will cd into that directory.

Because I am using yolov8, i will create a yolov8 virtual environment(venv)

conda create -n yolov8 python=3.9
conda activate yolov8
pip install ultralytics
pip3 install --upgrade torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121

**And to make recheck and sure CUDA is activated for us to use re-enter these commands:

python
import torch
torch.__version__
torch.cuda.is_available()

To exit:

exit()

Models

To get started, navigate to the directory you created and activate your venv. I decided to make a yolov8 directory in my Users Directory

cd C:\Users\YourName\yolov8

conda activate yolov8

Choose detection model for use case:Link

I will use the yolov8x.pt model
Pick one that fits your use case. I usually use a form of one below.

yolo task=detect mode=predict model=yolov8x.pt source=XXXXXXXXX show=true conf=0.7 line_width=2
yolo task=classify mode=predict model=yolov8x-cls.pt source=XXXXXXXXX show=true conf=0.7 line_width=2

As you see my model automtically downloads itself to my yolov8 directory upon use. Be aware you will recieve an error due to source. so be sure to input a source file to be inferenced.

Set source=photo.jpg
Set source=video.mp4
Set source= Link to Youtube Video
Set source=0 for Internal Webcam
Set source=http://CameraSource
Set source=Directory

[confidence] conf=0.5
[show real time] show=true
[save bounding box info] save_txt=true
[save cropped obj] save_crop=true
[hide labels] hide_labels=true
[hide conf] hide_conf=true
line_width=1

Some other useful options:

Predict settings

source: # (str, optional) source directory for images or videos
vid_stride: 1 # (int) video frame-rate stride
stream_buffer: False # (bool) buffer all streaming frames (True) or return the most recent frame (False)
visualize: False # (bool) visualize model features
augment: False # (bool) apply image augmentation to prediction sources
agnostic_nms: False # (bool) class-agnostic NMS
classes: # (int | list[int], optional) filter results by class, i.e. classes=0, or classes=[0,2,3]
retina_masks: False # (bool) use high-resolution segmentation masks
embed: # (list[int], optional) return feature vectors/embeddings from given layers

Visualize settings

show: False # (bool) show predicted images and videos if environment allows
save_frames: False # (bool) save predicted individual video frames
save_txt: False # (bool) save results as .txt file
save_conf: False # (bool) save results with confidence scores
save_crop: False # (bool) save cropped images with results
show_labels: True # (bool) show prediction labels, i.e. 'person'
show_conf: True # (bool) show prediction confidence, i.e. '0.99'
show_boxes: True # (bool) show prediction boxes
line_width: # (int, optional) line width of the bounding boxes. Scaled to image size if None.

More options can be found here

Training

If you are using PyCharm to train your model be sure to use terminal in pycharm to install ultralytics with:

pip install ultralytics

As PyCharm utilizes sandboxed virtual environements to run its code. Be sure to include any other dependencies you may need.



from ultralytics import YOLO

# Create a new YOLO model from scratch
model = YOLO("yolov8n.yaml")


# Train the model using the 'coco8.yaml' dataset for 3 epochs
results = model.train(data="config.yaml", epochs=100)
path: C:\Users\YourName\Dataset\ *root_directory
train: C:\Users\YourName\Dataset\ *train #relative path to path
val: C:\Users\YourName\Dataset\ *valid #relative path to path


#All classes
names: ['xxxx']
  0: xxxx
 

Errors we've encountered.

  1. We ran into an issue when running the model itself, we used a youtube video as a source, and after it downloaded its depencies, it failed to open the youtube video. We uninstalled and reinstalled conda, and followed the steps from step 3 onwards, skipping step 4 and 5. if that fails, we recomend uninstalling all the installed files, and re-attempting the install.

FTP Server

Scripts

About

Forest Buddy Server

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published