PyTorch is an open source machine learning library based on the Torch library, used for applications such as computer vision and natural language processing. It is free and open-source software released under the Modified BSD license.

You can use PyTorch to implement an object detector based on You Only Look Once (YOLO) v3. YOLO is an object detector that uses features learned by a deep convolutional neural network to detect an object.

Install YOLO

YOLO is a minimal PyTorch implementation, with support for training, inference, and evaluation. PyTorch is a machine learning (ML) library that you can use with vSphere Bitfusion. The YOLO tests are open-source ML applications designed to test the performance of your vSphere Bitfusion deployment.

The procedure is applicable for Ubuntu 20.04, CentOS 8, and Red Hat Linux 8.

Prerequisites

  • Verify you have installed a vSphere Bitfusion client.
  • Verify you have installed NVIDIA CUDA and NVIDIA cuDNN on your Linux operating system.
  • Verify that your virtual machine has at least 150 GB of free space.

Procedure

  1. Create a bitfusion folder and navigate to the folder.
    mkdir -p ~/bitfusion
    cd ~/bitfusion
  2. Install additional resources for an Ubuntu Linux operating system.
    1. Download package information from all your configured sources.
      sudo apt update
    2. Install zip.
      sudo apt install -y zip
    3. Install Python test resources.
      sudo apt install -y python3-testresources
    4. Install the libgl1-mesa-glx package.
      sudo apt install -y libgl1-mesa-glx
  3. Install git.
    • Ubuntu 20.04
      sudo apt install -y git
    • CentOS 8 and Red Hat Linux 8
      sudo yum install -y git
  4. Install pip3 by running the command sequence for your Linux distribution and version.
    • Ubuntu 20.04
      sudo apt install -y python3-pip
    • CentOS 8 and Red Hat Linux 8
      sudo yum install -y python36-devel
      sudo pip3 install -U pip setuptools
  5. Install YOLO and YOLO tests.
    1. Download the YOLO repository by using the git clone command.
      git clone https://github.com/eriklindernoren/PyTorch-YOLOv3
    2. Navigate to the weights folder.
      cd PyTorch-YOLOv3/weights
    3. Run the download_weights.sh installer script.
      bash download_weights.sh
    4. Navigate to the data folder.
      cd ../data
    5. Run the get_coco_dataset.sh installer script.
      bash get_coco_dataset.sh
    6. Navigate to the main folder by running the using the cd .. command.
    7. Install and use Poetry to complete the YOLO installation process.
      Poetry is a tool for dependency management and packaging in Python.
      pip3 install poetry --user
      export PATH=~/.local/bin:$PATH
      poetry install

Run YOLO Tests

By running the YOLO tests, you can check the performance of ML workloads in your vSphere Bitfusion environment.

Prerequisites

  • Verify you have installed a vSphere Bitfusion client.
  • Verify you have installed CUDA and cuDNN on your Linux distribution.
  • Verify you have installed YOLO and YOLO test scripts.

Procedure

  1. Navigate to the cd PyTorch-YOLOv3 folder.
  2. (Optional) Verify that you installed YOLO successfully.
    1. Run a YOLO test by using the CPUs of the virtual machine of your vSphere Bitfusion client.
      poetry run yolo-test --weights weights/yolov3.weights
    2. After YOLO starts, press Control + C on your keyboard to cancel the testing process.
      YOLO tests that use CPU compute power require a lot of time to finish.
  3. To run the yolov3.weights test script by using GPUs, use the bitfusion run command.
    By running the following command, you use the entire memory of a single GPU.
    bitfusion run -n 1 -- poetry run yolo-test --weights weights/yolov3.weights

Results

You can now run YOLO tests with vSphere Bitfusion with shared GPUs from a remote server. The tests help you to understand how to use YOLO within the machine learning discipline.