pibot:lesson5:softwarewin
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
pibot:lesson5:softwarewin [2022/01/03 11:55] – Changed terminology from "enter" to "type" jstruebel | pibot:lesson5:softwarewin [2022/10/20 19:53] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Software Setup ====== | ||
+ | |||
+ | - Open the VSCode from the Applications directory on the flash drive | ||
+ | - Click on the small green square in the bottom left corner of the screen\\ \\ <WRAP box>{{ : | ||
+ | - Select the " | ||
+ | - Type " | ||
+ | - Click the "Open Folder" | ||
+ | - Select the " | ||
+ | - Open a terminal in Visual Studio Code from the Terminal-> | ||
+ | - Type the following commands and press enter after each line to install the software required for this lesson\\ \\ < | ||
+ | sudo apt-get install python3-picamera python3-pil python3-opencv libjpeg-dev libfreetype6 libfreetype6-dev zlib1g-dev libwebp-dev libopenjp2-7-dev libatlas-base-dev fonts-freefont-ttf git</ | ||
+ | - Type the following commands and press enter after each line to install the Python libraries required for this lesson\\ \\ < | ||
+ | sudo pip3 install imutils</ | ||
+ | - Type the following command and press enter to install the Python Tensorflow Lite runtime for this lesson\\ \\< | ||
+ | - Type the following command and press enter to download the Python code for this lesson\\ \\ < | ||
+ | - Type the following command and press enter to change into the lesson 5 directory\\ \\ < | ||
+ | - Type the following commands and press enter after each line to download the object detection models\\ \\ < | ||
+ | curl -L ' | ||
+ | - Type the following command and press enter to start the object detection MJPEG Streamer server for this lesson\\ \\ < | ||
+ | - Open the Edge Application, | ||
+ | - Select the " | ||
+ | - Replace the **8899** on line 34 with **8080** | ||
+ | - Save the change by using the File-> | ||
+ | - Open a terminal in Visual Studio Code from the Terminal-> | ||
+ | - Type the following command and press enter to run the Python code for this lesson\\ \\ < | ||
+ | sudo python3 webcar.py</ | ||
+ | - Open the Edge Application, | ||
+ | - Drive the PiBot around and see what objects it detects | ||
+ | |||
+ | ====== Software Explanation ====== | ||
+ | |||
+ | The webstreaming.py file is another Flask app that streams images from the CSI Camera connected to the Raspberry Pi to your web browser after searching for objects within the image. | ||
+ | |||
+ | - In the webstreaming.py file, find the decorators. What do you think each of the functions is doing?\\ \\ <WRAP round tip>If you need a refresher on what decorators are, review [[: | ||
+ | - Find the generate function. What do you think this function does? Where is the function called?\\ \\ <WRAP round tip> | ||
+ | - Find the location in the code where data is saved to the outputFrame variable. What function is it in? What do you think this function does?\\ \\ <WRAP round tip>The while loop reads each image from the camera, performs object detection on it, draws boxes around the objects, and prints some statistics on the image before saving the image to the global outputFrame buffer</ | ||
+ | - Open the object_detector.py file\\ \\ <WRAP box>{{ : | ||
+ | - Find the detect function in the ObjectDetector class. Explore the different functions to see what it is doing.\\ \\ <WRAP round tip>When self is used in front of a function call it is referring to a function defined within that same class</ | ||
+ | - When you're finished driving the PiBot around, hold down the control + C keys and type the following command in the Visual Studio Code terminal to shutdown the PiBot\\ \\ < | ||
+ | - Click on the small green rectangle in the bottom left corner of the screen and select "Close Remote Connection" | ||
+ | - Wait 3-5 minutes for the green light on the Raspberry Pi to stop flashing and turn off the switch on the PiBot battery | ||
+ | |||
+ | [[: | ||
+ | |||