Requirements
Last updated
Last updated
If you are simply not interested on the process of creating the YOLO model and you just want to execute it on the board, I got you! Bellow are two links relative to a 16GB and a 32GB SD card images so you can flash them on your own SD card.
16GB SD card:
32GB SD card:
I will address the issue for smaller SD cards but for now you can work with those two options or up. After downloading the file, you will have to decompress it using WinRar. If you don't have WinRar, you can download it here.
After downloading WinRar, you will have to install it. The process is very simple and is just like any other program installation.
You might want to keep WinRar installed not only for future use on this project but also for general use. This application can compress files with better optimization and versatility than, for example, zip.
After having the SD card image uncompressed on your environment, you will need to flash it on your micro SD card. To do it, follow these steps:
Download Balena Etcher or Win32DiskImager;
Select the image file you just downloaded and uncompressed;
Select the SD card you want the image to be flashed in;
Click on Flash / Write;
I advise you to format the micro SD card before flashing the image file. This is to make sure it is empty and it won't cause any problems. Sometimes there's written data that we can't see or locate.
The process on each application is described on the images:
On Etcher it is pretty straight forward, you select the image file you want to flash, the SD card identified with it's Drive letter and then you just click on Flash and wait.
The process in Win32DiskImager is very similar but with a retro interface. You select the image and the drive and click on Write to start the flashing process.
After the flash process is finished (it might take a lot of time depending on the SD card size), you can remove the SD card from the slot and go to the Deployment on PYNQ-Z2 chapter to proceed.
Defining Hardware as the physical components of this project, we can make a brief list so you can have an idea. Don't be scared, it's actually only a bunch of cheap stuff except the PYNQ-Z2... If you stumble across this project is probable that you already own one so it's fine.
PYNQ-Z2 board;
Ethernet cable (RJ45);
Ethernet to USB adapter (if your computer doesn't have Ethernet port);
Micro-USB cable;
External power regulator 7 to 15 VDC (12V recommended);
Micro SD card 8GB minimum;
PEN Drive;
Before discussing in detail each requirement, we can make a brief calculation on costs. As you might expect, the elephant in the room is the PYNQ-Z2 which you already probably have. If you don't have one, be ready for a big investment on the Xilinx "Low Cost" PLD.
Hardware | Cost in Euro [€] |
---|---|
PYNQ-Z2 | 236 - 475 |
Ethernet cable | 2 - 20 |
Ethernet to USB adapter | 5 - 20 |
Micro-USB cable | 1 - 5 |
Power suply | 5 - 30 |
Micro SD card | 5 - 10 |
Pen Drive | 1 - |
Remember that these values are pretty rough since there are a lot of options out there. About the PYNQ-Z2 I found some used ones on Amazon sold for less than 300€ but some options go to 400€ and come with almost everything you need. On the TUL website you can even get one with acrylic protection! The rest of the material is pretty easy to find and it's pretty cheap so no worries there. What might be a little harder is the Power regulator because it has to obey some special requirements.
The PYNQ-Z2 in my case was lent by the Polytechnic Institute where I study so, lucky me. If that wasn't the case, I managed to find one for 337€ which includes everything.
The Ethernet Cable is called RJ45 and it is pretty easy to find. I would recommend you check in your home under the bed or on top of the fridge because there's always one lying around. But seriously now, sometimes the internet router you have at home comes with one of these cables so you might check that out. If you don't have one you can buy a cheap one since the reliability won't be a priority. You only might take consideration the speed since they can go from 10 to 100Mbps.
In case you have a Laptop or Computer without RJ45 interface, you need to get a adapter to USB or USB C. I got one from D-Link and it supports USB 3.0 and works like a charm. You might consider obtaining one to USB C if you have that port on the machine.
The micro-USB cable is pretty common since older Smart phones used this type of cable before changing to USB type C. With that in mind you might find one in your home, in the pile of technological garbage. If not, you might buy one for cheap or ask a friend!
About the micro SD card, I would recommend 16GB of storage space to have a huge margin. You may use a 8GB micro SD card with no consequences at all so don't worry. What you will also need is a SD card adapter so you can insert the card on your computer.
The PEN drive is only a requirement so you can transfer between Operating Systems and to store the important steps of your project. I am pretty sure you already have on or two at home lying around. If you don't have one, you would be surprised how cheap they got over the years. You can get a lot of storage for low prices nowadays.
Lastly I want to talk about the Power Adapter. Don't be fooled by the fancy name! This is nothing more that a transformer like the one you have for your Laptop or Smart phone. What is important to note here is that the transformer can output anywhere between 7 and 15 Vols of continuous current (DC). Don't worry so much about DC because normally it's always DC when working with small devices. AC would be a catastrophe here...
In general the most common transformer value on the required range is 12V and as it leans towards a higher voltage, they recommend you use that one. The next requirement about the Power adapter is very important and I need you to stay focused here. The output of the transformer will go to a cable which plug should be coaxial, center positive and have 2,1mm internal diameter. To check the diameter you can take a look at the board's Power Jack (DC1). To check if it's center positive, you might pick-up the dusty old multi meter and do the following measurement:
So, as described on the image, you pick up the multi meter, place the red wire on the Voltage jack and the black one on the COM jack. Then, rotate the meter to voltage measurement, specifically the value that covers the transformer output voltage (20 volts is greater than 12 or 15). Then you place the red tip inside the plug, making sure it touches the inside metal and also place the black tip on the outside metal cover. Don't forget to plug the transformer to the outlet and don't be afraid because it's only a 12V shock!
We need to make sure the center is positive or the plug won't work on the board.
It's important to have a Power Supply because for a demanding application like running YOLO, the power from the micro-USB cable won't be enough.
This is all for Hardware on this project. You can then explore new horizons with the PYNQ-Z2 and attach more peripherals like USB webcam, HDMI monitor, arduino, ...
There's quite a lot of software requirements for this project. That is quite subjective, of course, but I found my Laptop running out of storage multiple times when I needed to install programs. Anyway, here we will talk about what you will need in terms of software to make this project start to finish. I should note that I will provide some files on the github repository that you can re-use, making it possible for you to skip entire processes therefore not needing to install heavy software.
The majority of this project can be done on a Windows Operating System (OS) but the second stage, referring to the Model optimization and compilation, requires Ubuntu 16.04 or 18.04. Ubuntu is a Linux distribution and a open-source alternative to other Operating Systems. If you already have that OS then that is the best possible outcome. If you have a Windows OS like everyone else, I will recommend doing a Dual Boot on your computer or to just skip that chapter completely.
Dual boot consists on having two different Operating Systems on the same computer, sharing different partitions of the same Storage device or not. On my case I have a Laptop with a 500GB Solid State Drive - SSD and I allocated 80GB to the Ubuntu OS and the rest remained for the Windows OS. Some computers might have multiple Storage units (SSD or HD) and that leaves the option to allocate one entire disk unit for Ubuntu.
I will guide you trough the Dual Boot process on the Model optimization and compilation chapter where it's needed. For now let's continue on and delay the stress of the dual boot for your future self.
I will give you the required software to install on Windows. Of course, if you are totally working with a computer with Ubuntu 16.04 or 18.04 you can do this part there as I said earlier. For instance we will be needing the following list of programs:
Vivado suite;
VirtualBox;
MobaXterm;
AOMEI Partition Assistant;
MiniTool Partition Wizard;
Let's briefly go through each of this programs. I won't get into much detail here as they will be better explored when needed along this guide.
This is where the Hardware will be created. This tool is very heavy in terms of storage, occupying about 30GB. It will just be needed once to create the DPU so if you ensure you do it correctly, you can delete it right after you generate the required files.
Very important piece of software that will be responsible for supporting a virtual machine (VM). A VM is basically a computer executing inside your computer. Pretty cool, right?
There is the native system (Windows) and then there will be the Guest system (Ubuntu) running on the VM. Part of the resources from the computer will be used to execute the Virtual Machine.
VirtualBox is a program that can execute and manage Virtual Machines and it was the one I chose for this project. Note that you can absolutely use any other program to do this.
To work with the PYNQ-Z2 we will need a interface. Normally, the interface on the regular SD card image for the PYNQ-Z2 is done with Jupyter Notebook. But here, we will make a custom system and so to visualize what is actually being done we will use MobaXterm. This program allows direct control of the board via SSH (The Ethernet cable) displaying a Terminal Window.
This program is all about managing disks. This will be useful to separate the micro SD card in two partitions and can also be used to format any type of external storage device.
To do the Dual Boot process on the computer we will need to manage the internal storage disk so we can separate a partition for the Ubuntu OS. This can be done directly using a native Windows application but some cases it isn't possible. For instance, I had to Dual Boot my computer two times and the first I could do with the Windows Disk Manager but the second time I had to use this tool as there were some optimization problems or something.
On Ubuntu we will only need to install DNNDK. I know, Dual Boot the computer just to use one single tool looks to be a little overkill. But there was no option at the time. You might be thinking "Why don't we use a Virtual Machine to use DNNDK?". The reason is that VirtualBox doesn't extract all the features from the CPU, like AVX instructions and FMA. The problem is that compiling Tensorflow for DNNDK requires these features and the other way to go around this would be to manually compile Tensorflow or to search for another VM software. Those options are absolutely possible but I was running out of time...
We will go through all the details and the installation of DNNDK on the chapter Model optimization and compilation. If you didn't understand very much what was said don't worry because we will get into detail later.
On Ubuntu we will also use a software for the metrics which doesn't require much resources and we will have a large dataset that occupies about 20GB.
Here we will briefly discuss what is the overall storage space needed to do this project considering you want to do it start to finish. We have to consider that after each step you can delete the software used and so we will be able to calculate a minimum storage space needed. On the other hand, if you want to keep all the programs and setup for future works we will also make a calculation for disk space. Then, I will also make my recommendation for what to keep for future works on this subject.
I have made a graph that has an overview on storage space for each application so you can have a better idea on what you will be working with.
As you can see, we will need the following storage space for each application:
Application | Storage (GB) |
---|---|
Vivado | 30 |
Petalinux | 60 |
DNNDK | 2 |
COCO dataset | 20 |
So, for Windows we will need at least 90GB but to be safe and have space for other applications you might already have, I would recommend a minimum of 200GB. As for the Ubuntu OS you should be fine with about 40GB, since there's also the need for virtual environments and packages that need a lot of space. In the end, to be safe and have space to work around and have other stuff and not only the project, I would say that 200GB for Windows and 70GB for Ubuntu is enough.
Now the minimum storage takes in consideration you uninstall the applications after use. So, on Windows, you should be fine with 100GB or even 70GB to finish the DPU implementation. On Ubuntu you will need at least 30GB to work with everything.