1

I was trying to upload ultralytics to google cloud. I added ultralytics to my requirements.txt file. Then when I deploy my files to google cloud. It says installation complete. But after deploying... the console gives the following error (unable to watch for file changes in this large workspace). After that, the console goes offline. If I go online again, everything I do is reset.

1 Answers1

1

Here's the fastest way (allows you to quickly deploy new models, just by changing a model version number):

Option 1:

https://docs.roboflow.com/upload-weights

  • You'll have the ability to utilize multiple deployment options, such as cloud, edge device (i.e NVIDIA Jetson or Luxonis OAK), mobile device (iOS SDK), and other local devices or servers: https://docs.roboflow.com/inference-2.0-beta

Roboflow Inference 2.0

Next, follow steps 1-5 below, and be sure you install the Roboflow Python SDK after step 5:

pip install roboflow

Run inference:

# accessing the model
rf = Roboflow(api_key="YOUR_API_KEY")
inference_project =  rf.workspace().project("YOUR_PROJECT_NAME")
model = inference_project.version(1).model

# adjusting the model confidence threshold
model.confidence = 50
model.overlap = 25

# using the model
predictions = model.predict("PATH_TO_IMAGE").json()["predictions"]

Roboflow Python Package - Quick Start


Option 2:

You can install ultralytics in Google Cloud using a virtual machine (VM) and setting up the necessary environment. I've outlined the process below:

  1. Create a Virtual Machine (VM):

    • Navigate to the Google Cloud Console.
    • From the navigation menu, select Compute Engine > VM Instances.
    • Click on "Create Instance".
    • Fill the necessary fields like Name, Region, Machine type, etc.
    • In the Boot disk section, choose an Ubuntu image, such as Ubuntu 20.04.
    • Allow full access to all Cloud APIs.
    • Click "Create" to initiate your VM.
  2. SSH into the VM:

    • Once your VM is ready, click on the SSH button to access the command line.
  3. Update and Upgrade your VM:

    • Run the command below to update the package lists for upgrades for packages that need upgrading, and for new packages that have just been updated or added to the repositories.

      sudo apt-get update
      sudo apt-get upgrade
      
  4. Install Necessary Libraries and Packages:

    • For an added check to ensure you can install everything, you should install some necessary libraries and packages such as build-essential and cmake. Also, you should install python3 and pip3 if they are not already installed.

      sudo apt-get install build-essential cmake
      sudo apt-get install python3-dev python3-pip
      
  5. Install Git:

    sudo apt-get install git
    
  6. Install PyTorch and Torchvision:

    • Since ultralytics is built on PyTorch, you'll want to install PyTorch, along with torchvision.

    • You can find the latest installation command for your configuration at the PyTorch website (https://pytorch.org/). Here's an example command:

      pip3 install torch torchvision
      
  7. Clone the ultralytics Repository:

    • Now that you have everything ready, you can clone the ultralytics repository:

      git clone https://github.com/ultralytics/ultralytics.git
      
  8. Navigate to the ultralytics Directory:

    • After cloning, a new directory named ultralytics will be created. Navigate into it:

      cd ultralytics
      
  9. Install the Required Python Packages:

    pip3 install -r requirements.txt
    
  10. Check the Installation:

    • To confirm the installation in your VM, run the following command to see if ultralytics can be run successfully for model inference, configure the command based on the model you are running:

      yolo predict model=yolov8n.pt source='https://ultralytics.com/images/bus.jpg'
      

If you want to use GPU acceleration, you need to create a VM with GPU and install necessary CUDA libraries based on the GPU model.

  • Thanks for the suggestion. Is there a way to simply deploy my existing model to Roboflow without generating the dataset from scratch? – selcuk-sahin Jun 12 '23 at 08:06