This problem is about dividing the set of iris flowers in different groups based on the flower features. Those features are the length and width of a sepal and the length and width of a petal. For this tutorial, assume that the type of each flower is unknown. You want to learn the structure of a data set from the features and predict how a data instance fits this structure.
A couple of
days ago I wrote (a personal reminder post) about how to add automatic connect
to Wi-Fi and SSH enabled in a bootable Raspbian image in a SD card (see references).
I also explained that this was required for me because, by default Raspberry Pi
4 video ports were not starting with a 1920 x 1080p resolution.
Remember that now, the 2 video ports supports 4K !
I was digging and reading about this, and I found another quick fix to solve this problem. Once you had a Raspbian image in a SD card, you can edit the file [config.txt] for some amazing cool tweaks! (Also, see references)
For me, my main change was in the [hdmi_safe] parameter. Setting hdmi_safe to 1 will lead to “safe mode” settings being used to try to boot with maximum HDMI compatibility.
# uncomment if you get no picture on HDMI for a default "safe" mode hdmi_safe=1
the device will start automatically in a safe and standard mode. And, yes, it
will work with my old and crappy test monitor!
Now that I
have my amazing Raspberry Pi 4 with 4GB RAM, it’s time to see how serious the
device is. So, I decided to install and use some developers’ tools in the RPi. My
dev list will be something like this
Some ML and AI Python packages
Visual Studio Code
It’s been a while since I installed VSCode in the device. The last time I did this, I needed to download the code from GitHub and compile the tool in the Raspberry Pi. As far as I remember this was a +25 min process.
Lucky for us the process can now be much simpler, thanks to Headmelted
(see references). Now, we only need a single command to install VSCode:
Install process started! Or Maybe not because I found this
amazing GPG error
pi@rpidev3:~ $ curl -L https://code.headmelted.com/installers/apt.sh | sudo bash % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 2349 0 2349 0 0 19739 0 --:--:-- --:--:-- --:--:-- 19906 Detecting architecture… Ensuring curl is installed Reading package lists… Done Building dependency tree Reading state information… Done curl is already the newest version (7.64.0-4). The following packages were automatically installed and are no longer required: python3-pyperclip python3-thonny rpi.gpio-common Use 'apt autoremove' to remove them. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. Architecture detected as armv7l… Retrieving GPG key headmelted… % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 gpg: no valid OpenPGP data found. Removing any previous entry to headmelted repository Installing [headmelted] repository… Updating APT cache… Hit:1 http://raspbian.raspberrypi.org/raspbian buster InRelease Hit:2 http://archive.raspberrypi.org/debian buster InRelease Get:3 https://packagecloud.io/headmelted/codebuilds/debian stretch InRelease [23.4 kB] Err:3 https://packagecloud.io/headmelted/codebuilds/debian stretch InRelease The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 0CC3FD642696BFC8 Reading package lists… W: GPG error: https://packagecloud.io/headmelted/codebuilds/debian stretch InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 0CC3FD642696BFC8 E: The repository 'https://packagecloud.io/headmelted/codebuilds/debian stretch InRelease' is not signed. Done! Repository install complete. Installing Visual Studio Code from [stretch]… Reading package lists… Done E: The value 'stretch' is invalid for APT::Default-Release as such a release is not available in the sources Visual Studio Code install failed.
There a public GPG key used to verify the package and the SH
script somehow does not download it (I think the ARM RPI version is still not
defined). So, before the previous command, I need to run this command
But, yes another but, you may note that the tool open and
display a black window. Again, I need to go deeper on the details, but the
latest version does not work well. There is some context information on GitHub
(see references), and the proposed solution is to rollback to a previous
sudo apt-get install code-oss=1.29.0-1539702286
And we also need to disable the automatic updates on this
sudo apt-mark hold code-oss
And now, yes, we got a fully functional Visual Studio Code
in our Raspberry Pi!
to do some tests with the new Raspberry Pi 4 and the results are amazing. I’m
not a performance expert, so I decided to pick up some of the demos / apps I’ve
creating for the Raspberry Pi and run them in both models: Raspberry Pi 3 B+ and
Raspberry Pi 4.
I started with an amazing set of tutorials on how to perform Face Recognition from Adrian Rosebrock (see references). I’ve been using his Face Recognition python package for this scenarios and it’s an amazing one.
I added some code to a custom version of Adrian’s Face Recognition sample, and it looks great. The main idea was to track in real-time the current FPS (similar to the work I did with the Image AI and Hololens sample a couple of days ago, see references).
load a file with 15 trained faces and analyze frame by frame to
Detect faces in the frame.
If a face is detected, draw a frame around it.
For each detected frame analyze if the face is a trained face.
If the face is part of the trained dataset, the app will add the name of the person on top of the frame.
I display in real-time the FPS processed with a USB camera in a Raspberry Pi 3 B+. Doing a lot of tweaks and getting the best performance in the device I could never process 1FPS. The average processing data were between 0.6 and 0.9 FPS in a Raspberry Pi 3B+.
IMHO, these results are great for a small device like a Raspberry Pi 3B+. But now it was time to test it in the new Raspberry Pi 4. And an important note here is to remark that even if I did this tests in a Raspberry Pi 4 with 4GB of Rams, the performance results are similar to a RPI4 with just 1 GB of ram. We have more memory, however the processor improvements are quite significant in the new version.
I installed all the necessary software in the Raspberry Pi 4 and I got 3X better results. I’ve even tun this in a 1080p resolution to get a sense of the real processing time. The average processing data were between 2.3 and 2.4 FPS in a Raspberry Pi 4.
this scenario the Raspberry Pi 4 is almost 3 times faster than the Raspberry Pi
3. And again, these are amazing times for a 50USD device.
content is very straight forward to understand. Main values to complete are [ssid]
Important: This only works the first time you boot the Raspberry Pi with the SD card. The SO search for [wpa_supplicant.conf] and performs the connection. If you already booted the device, you need to create a bootable SD card again.
If you also
want to enable SSH, you need to create a blank file named [ssh] to the main
it, your Raspberry Pi will be connected to the Wifi and with SSH enabled!
I’ll write this down, so I don’t forget in the near future. I’m not a Linux user, and that’s amazing. Every day I learn something new, mostly while I’m working with Python, Visual Studio Code and Raspberry Pi.
So, I received a couple of brand new Raspberry Pi 4, and now it’s time to test them. And of course, most of this job is via SSH / command line. I’m not an expert (yet) on Raspberry Pi user permissions, however I started to realize when I need to use “sudo” to get things done.
If you search for sudo definition, you may find something similar to this one:
Sudo stands for either “substitute user do” or “super user do” (depending upon how you want to look at it)
Today, I’ve learned the power of the “alias” command, and how it can be used to have a more polite conversation with my device. In example, I can create an alias for sudo, named “please” and then this happen.
This is a very polite way to display my Raspberry Pi4 CPU information
Or another polite way to display Disk information for the Raspberry Pi 4
In my previous
post I created a sample on how to use ImageAI and OpenCV to detect Hololens
from a webcam frame (see references). I added some code to the last sample, and
I found that the performance was not very good.
previous sample code, I couldn’t process more than 1 frame per second. So, I
started to make some improvements and I got this result
amazing one, but still is nice to have more than 1 frame per second analyzed.
I even remove
all the camera preview and still works in less than 1FPS.
So, now it’s
time to read and learn of the deep code on ImageAI. Fun times!