Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

You will want to experiment with different frame rates and video lengths to see how effectively they work with in our cluster counter. The video used in this tutorial was filmed at 250 fps and is 17 seconds long. We are actively testing much lower frame rates (60 fps) and longer videos and we will update this document as we come up with further recommendations.

Setup the Video Counter

Get Organized

  1. Sign in to drive.google.com using your Google account. Click on ‘My Drive’ to see any existing files/folders in your Google Drive. Click ‘New’ → ‘New folder’ to create a new folder for your project. For the sake of this tutorial, call the folder ‘Computer_Vision’.

    Screenshot 2024-04-30 at 7.51.50 AM.png

    Screenshot 2024-04-30 at 7.52.13 AM.png

    Screenshot 2024-04-30 at 7.52.45 AM.png

  2. Next, double-click into your ‘Computer_Vision’ folder. Inside this folder, we will upload our model weights alongside the video file you have captured with your phone. For this tutorial, download our ‘nighttime-grape-flower-clusters’ and upload it to your ‘Computer_Vision’ folder. You can download the file here:

    View file
    namenighttime-grape-flower-clusters.pt

  3. At this point, you should have a video file and a trained model next to each other in your ‘Computer_Vision’ folder. For the sake of this tutorial, we’ll name our file ‘test.MOV’. Don’t worry if your video file is in a different format; our processing script will convert it later.

    Screenshot 2024-04-30 at 12.58.28 PM.png

Configure the Colab

  1. In a new tab, open up our Colab notebook: https://colab.research.google.com/drive/1zMc-4Bjtxt-Ye2N4p2VKG3wqWovmNzmG?usp=sharing

  2. Click ‘Copy to Drive’. This will copy the notebook to your Google Drive and open it in a new tab.

    Screenshot 2024-04-30 at 1.21.51 PM.png
  3. In your copy of the Colab, go to the ‘Runtime’ menu and select ‘Change runtime type’. Make sure a GPU option is selected such as 'T4 GPU'.

    Screenshot 2024-04-30 at 1.27.25 PM.pngImage Added

    Screenshot 2024-04-30 at 1.27.42 PM.pngImage Added

  4. Finally, adjust the settings block. Here are what each variable in that block means:

    • RAW_VIDEO_PATH - This points to your Google Drive (/content/drive/MyDrive/) and the location and name of the raw video you uploaded.

    • CONVERTED_VIDEO_PATH - You do not need to change this. This is where the script will copy your video to after converting it to a .mp4

    • MODEL_PATH - This points to your Google Drive (/content/drive/MyDrive/) and the location and name of the model you uploaded.

    • FINAL_VIDEO_PATH - You do not need to adjust this. This tells the script where to save the final video with clusters counted.

    • SAVE_PATH - This points to your Google Drive (/content/drive/MyDrive/) and the location and name of the final video you want saved back to your drive.

      Screenshot 2024-04-30 at 1.38.01 PM.pngImage Added

Run Through the Script

At this point, you should be all set to analyze your video and count the clusters! Simply step through one code block at a time pressing the little play button on the left and waiting for a checkbox to appear. Some blocks will take a significantly longer time to run. Be sure not to close the Colab or you will have to start at the top again (despite the checkboxes remaining).

...

Finished!

When all of the code blocks have been run, you should have a processed video on your Google Drive