Cogito — v1 [Raspi and Database]

So as last mentioned in the V0, the Thermal Printing need to connected to a Raspberry Pi (aka raspi) to work. So why not make all the computation on this micro computer ? If made, the project could look like more as an devices than a program on a computer, we could think of a box (3d printed ? made with which material) that could contain the RaspPi, the printer and a micro camera. It kinds of project the algorithms into a new dynamic. So I installed all the dependencies into the RasPi (mostly using apt-get and pip) I got lot of issues about dlib a framework used for machine learning, I had to make some compilation which can be “too much” for the Raspi and used all the RAM allocated. So I had to change the compiler method and build the lib from the CLI interface (booting into the UNIX with no interface at all). In fact I followed a “tutorial”, but it was too old and the dlib library can be installed much more easier now.

Then I bought a Camera Module V2.1 for Raspi and I had to change some parts of the code — I used the video Capture module from OpenCV but it could work on raspi and on raspi Pi camera. So, lots of issues add up when working with Rasberry Pi.

Then I questioned the dataset I was using. I was scraping the images from their website but in order to get more image it would take a lot of time. Also sometime my script downloaded multiple same image.

It appeared that the Computer Science engineer working on these generation were working for Nvidia. And they put online 100k images made by these algorithm (Also the model was trained on image from Flickr)

you can access these image here :

I tried to download all the images at once : my computer crashed.

Then I downloaded it parts by parts (1k by 1k) I managed to get 20k images.

It’s cool but it’s heavy (26 GB) — I converted all the images components into the database (it has took multiples hours) then since I knew that I would print the image into a Thermal Printer, I reduced the size (According to the dpi the image came from 1024×1024 to 384×384 ) and the colormode to gray.