Skip to content
dorkmo edited this page Oct 16, 2020 · 68 revisions

https://docs.google.com/document/d/1gO65cVNYTvvhwhrbx3-UdZ5DvoqROfvu1LpdEDto9AM/edit

Fetch Image Script

https://github.com/commaai/openpilot/commit/d1d2984f366e6b541b80c5364cd1f17f817ecb02

if you added labelled images from a comma two / EON we would accept them, grab them with FrameReader from the hevc file -geohot

Windows with WSL (Windows Subsystem for Linux)

Setup

  1. Update Windows to at least the Windows 10 Fall Creators Update (released in 2017).
    https://support.microsoft.com/en-gb/help/4028685/windows-10-get-the-update

  2. Install WSL
    search 'PowerShell' in the Windows search bar
    right click on the App and select "Run as administrator"
    Type following command to install WSL
    dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
    Press Enter
    Once complete, close the Powershell window

  3. Download and install Ubuntu 1804
    https://www.microsoft.com/en-us/p/ubuntu-1804-lts/9n9tngvndl3q

  4. Download and install VLC media player
    https://www.videolan.org/vlc/

  5. Download specific openpilot version to windows
    Go to link https://github.com/commaai/openpilot/tree/d1d2984f366e6b541b80c5364cd1f17f817ecb02
    Click the green "Code" button
    Click "Download ZIP"
    Open the .zip file with Windows File Explorer
    Click the pink "Extract" bar at the top
    Click the "Extract all" button
    In the "Select a Destination" box, type "C:\openpilot"

  6. Run Install Commands
    Go to the C:\openpilot folder in File Explorer
    Hold the Shift key and right click on the white background
    Select "Open Linux Shell here"
    Type in the following commands:
    cd tools
    Press Enter
    ./ubuntu_setup.sh
    Press Enter
    Setup will take about 10-30 minutes, then continue...
    pip3 install -r requirements.txt && pip3 install pillow

Retrieve an Image

  1. Login to comma server
    Type in the following commands:
    cd ..
    Press Enter
    C:\openpilot=/mnt/c/Users/endof/Desktop/openpilot python3 tools/lib/auth.py
    Press Enter
    A browser window should automatically open.
    Login to the google account that is paired with your openpilot device.

  2. Select an image frame
    Open a new web browser window
    Go to https://my.comma.ai/
    Download the segment video file that includes the desired image frame
    Right click on the .hevc file and select "Open with.."
    Choose "VLC media player"
    Watching the video to find the desired image
    Note: VLC does not show a timestamp for .hevc files
    Open your smartphone's stopwatch app
    Start the video from the beginning and start the stopwatch simultaneously
    Stop the stopwatch at the desired image
    Multiply the number of seconds by 30 to get the image's frame number

  3. Format a Fetch Image Script Command
    search 'Notepad' in the Windows search bar and open it
    Copy then paste the following template into Notepad
    C:\openpilot=/mnt/c/Users/endof/desktop/openpilot python3 tools/scripts/fetch_image_from_route.py "X" N F
    Replace the F in the template with the frame number calculated from the video
    In the my.comma.ai explorer, click "copy current segment” for the desired video
    On a new line, paste the segment info into Notepad
    Note the last number in the segment info
    Replace the N in the template with the segment info's last
    Delete the ending number and two dashes --N from the segment info
    Replace the X in the template with the shortened segment info
    For example: your segment info would start like this
    23b69975490100e4|2020-06-29--13-54-04--3
    ...and your edited template command should look like this
    C:\openpilot=/mnt/c/Users/endof/desktop/openpilot python3 tools/scripts/fetch_image_from_route.py "23b69975490100e4|2020-06-29--13-54-04" 3 600

  4. Run Fetch Image Script
    Go back to the Linux Shell window
    Enter the command formatted with the segment info and frame number
    Press Enter
    You will see “got api response”
    A .png image will be created in the openpilot folder

  5. Rename File and Submit
    Check to see the last submitted user image number
    Go to the Spreadsheet
    Press Crtl+F to use the search function
    type u0 to find the first user image on the list
    Use the arrows to find the following user images
    Pick the next number that has not already been used for your image
    In File Explorer, change the beginning of the image file name
    For example, the second user image's file should look like the following:
    u002_23b69975490100e4_2020-06-29--13-54-04_3_600.png

Clone this wiki locally