User avatar
jbeale
Posts: 3644
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

Image recognition - what 4GB of memory can do

Tue Dec 17, 2019 3:24 am

Here is a concrete example of what more memory can do for you. The open-source "Yolo v3" program can recognize and localize objects in an image. https://pjreddie.com/darknet/yolo/

A Pi4 with 1GB of memory can run the "Yolo v3 TINY" model because it only needs 388 MB, but you need 1.65 GB free to run the full Yolo v3 program. I guess a 4GB Pi4 would be needed as you might not have that much actual user-space memory available with a 2GB model. I installed Yolo V3 Tiny with the NNPACK speedup on a Pi4-1GB as described at this tutorial: https://funofdiy.blogspot.com/2018/08/d ... 8076787583
Note, I am on Ubuntu Server 64, because an earlier try with the original Yolo code has a fault with word alignment issues under Raspbian 32 bit.
Not yet owning a 4GB Pi4, for a comparison I also tried out the full Yolo-v3 on a MiniPC with 8GB.

This image below shows how much better the full Yolo-v3 program is than the "TINY" version. Starting from a low-quality image of two people walking at night, the "TINY" version finds one person at 61% confidence with a not-very-accurate bounding box, while the full Yolo-v3 program finds both people with 99% confidence, AND an accurate bounding box around each person, despite the upper torso and head of the right-most person being nearly at background noise. Comparison: https://photos.app.goo.gl/2MHLRPrcknno7fyB9
Yolo-Compared-480.jpg
Yolo-Compared-480.jpg (43.61 KiB) Viewed 4453 times

ejolson
Posts: 5150
Joined: Tue Mar 18, 2014 11:47 am

Re: Image recognition - what 4GB of memory can do

Tue Dec 17, 2019 5:29 am

jbeale wrote:
Tue Dec 17, 2019 3:24 am
Here is a concrete example of what more memory can do for you.
Clearly the larger model makes a big difference. Is that your photograph and comparison? A 2GB Pi might have enough to run a 1.6 GB model. I think there is a boot option that can be used to turn a 4GB model into a 2GB. How difficult would this be to check?

User avatar
jbeale
Posts: 3644
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

Re: Image recognition - what 4GB of memory can do

Tue Dec 17, 2019 6:08 am

Yes all the images are mine. The source is an IP camera, with a somewhat larger field of view; this is only a crop of the full frame. The "Yolo 3 Tiny" version was created on my 1GB RPi4. Someone who has a 2GB or 4GB Pi4 would be able to test what is possible with the full Yolo program on that platform. I should add that the other variable is time; the "Tiny" version (also using NNPACK) completes an image in under 1 second on the Pi4. The full, original Yolo-v3 takes about 70 seconds per image on my 8GB Linux Mint "fitlet2" MiniPC. That is CPU-only; Yolo was designed for the latest, largest, fastest GPUs, on which it can do real-time recognition.

If you use the original Yolo code from the pjreddie.com site, you also need to run it on a 64-bit OS like Ubuntu Server 64 for Pi for it to complete without a memory alignment fault. I found Ubuntu was quite easy to write to a SD card and run on the Pi4, starting from https://ubuntu.com/download/raspberry-pi If you use the modified code for Pi in the tutorial linked to above, there's some additional steps including building the NNPACK package, although that does provide a useful speed boost.

The full Yolo performance is frankly impressive to me. At first I had to look at the raw image a little while to be confident the figure on the right is in fact a person, and I have to guess a little bit around the head area. The one on the left has a more clear upper body with the two-tone jacket, but the leg profile is noisy and confused by a lighter ground area from a flashlight they're holding. Still, the program confidently and correctly sees the boundaries of both people. As far as I know, even a short time ago this level of automated image recognition was not possible even on large hardware.

DangerousThing
Posts: 5
Joined: Mon Feb 03, 2014 7:17 pm

Re: Image recognition - what 4GB of memory can do

Wed Dec 18, 2019 9:13 am

Have you tested YOLO on a Jetson Nano?

Jay

User avatar
jbeale
Posts: 3644
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

Re: Image recognition - what 4GB of memory can do

Thu Dec 19, 2019 8:10 pm

I don't have a Jetson Nano, but if anyone would like to try this on whatever platform, the input file is at https://github.com/jbeale1/detect
I saw a video showing Jetson running full Yolo3 at 2 fps, and "-tiny" version at 15 fps: https://www.youtube.com/watch?v=K03WZyee6ig

In other news, Santa dropped by early this year, so I can now run this on a Pi4 w/4GB.

It is nearly exactly as fast as my Intel Mint box, running the original Yolo-v3 as linked on https://pjreddie.com/darknet/yolo/
There is a NNPACK speeded-up version on the Pi (which does not run on the Intel due to J3455 cpu lacking AVX2 instructions) as described at http://funofdiy.blogspot.com/2018/08/de ... -real.html

The original Yolo3 was designed for a GPU. Running on a CPU it uses only one core, but the NNPACK version uses all 4 cores and I assume other optimizations given it runs HUGELY FASTER on Pi4 with an over 10x speedup vs the original code on the J3455. Reported time is under 6 seconds per frame, vs 77 seconds. However results are also not the same: the bounding boxes look similar, but it only claims 96% confidence rather than 99%. I wonder if it's using ints or floats vs double-precision, or similar.

Running the NNPACK version on the Pi4 with '/usr/bin/time -v' to measure peak memory usage reports 2240488 kbytes so I guess a 2GB Pi would not work here.

Code: Select all

(Yolo3, Intel J3455) Enter Image Path: DH6_191216_182725_walking.jpg
DH6_191216_182725_walking.jpg: Predicted in 77.908261 seconds.
person: 99%
person: 99%

(Yolo3, Pi4) Enter Image Path: DH6_191216_182725_walking.jpg
DH6_191216_182725_walking.jpg: Predicted in 76.782849 seconds.
person: 99%
person: 99%

(Yolo3+NNPACK, Pi4) Enter Image Path: DH6_191216_182725_walking.jpg
DH6_191216_182725_walking.jpg: Predicted in 5.476896 seconds.
6
Box 0 at (x,y)=(0.458732,0.490430) with (w,h)=(0.070362,0.289801)
Box 1 at (x,y)=(0.468734,0.487165) with (w,h)=(0.068441,0.303718)
Box 2 at (x,y)=(0.532071,0.472344) with (w,h)=(0.080526,0.313897)
Box 3 at (x,y)=(0.545931,0.471976) with (w,h)=(0.080988,0.327694)
Box 4 at (x,y)=(0.457965,0.506113) with (w,h)=(0.068575,0.269283)
Box 5 at (x,y)=(0.466631,0.504655) with (w,h)=(0.065420,0.289816)
person: 96%
person: 95%
Pi4-4GB-Predictions.jpg
output from Yolov3-NNPACK on Pi4_4GB
Pi4-4GB-Predictions.jpg (47.8 KiB) Viewed 4187 times

User avatar
Gavinmc42
Posts: 4502
Joined: Wed Aug 28, 2013 3:31 am

Re: Image recognition - what 4GB of memory can do

Fri Dec 20, 2019 5:21 am

Cool stuff John.
I had been wondering about CV on the Pi4.
Recently installed opencv-python ok in Gentoo64, but it is a xmas break project.
Now I can compare it against something else.

What about movement detection triggering a people detector?
The movement area is a subset of the whole frame so faster processing for people?

Detecting moving cars and rejecting them will save me from recording 2000-3000 videos per day.
It needs some training for camels and eagles or in my case kangaroos.
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

User avatar
jbeale
Posts: 3644
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

Re: Image recognition - what 4GB of memory can do

Fri Dec 20, 2019 6:14 am

Note that Yolo-v3 runs only slightly faster with smaller input image sizes. 1920x1080 takes 5.4 seconds while the same image at 25% scale (480x270) with 1/16 the pixel count, still takes 3.4 seconds (and detection and localization is also nearly the same). Scaling down another 50% to 240x135 gains nothing more, still 3.4 seconds (and it still detects and localizes well). It's crunching through the fixed-size recognition network that takes the time.

Even the "-tiny" version does not run at video rates on the Pi, but it can still be useful. I use motion detection in OpenCV to capture a frame when a moving object gets nearest to the center of the frame. The camera sees the road, so this is usually a car- but not always. On average there aren't more than two events per minute, so any process that takes less than 30 seconds per image can still be used to sort events into bins. The NNPACK-accelerated version of full Yolo-v3 on a Pi4-4GB is plenty fast enough to keep up with that timing. So if you wanted to count how many cars, pedestrians, dogs, and bicycles went past in a given day, for example, you could do that.
person-bike-pred.jpg
person-bike-pred.jpg (43.82 KiB) Viewed 4098 times

User avatar
Gavinmc42
Posts: 4502
Joined: Wed Aug 28, 2013 3:31 am

Re: Image recognition - what 4GB of memory can do

Fri Dec 20, 2019 8:12 am

With 4GB of ram, plenty of video buffer room.
But 1GBs Ethernet and USB3, Distributed Computing for recog?
How many Pi4s needed for "realtime"?

Will be interesting to run this Yolo over 5 years of videos.
This is the first thing that looks like it might work running on Pi's.
Set up a Pi4 with other Pi's running MotionEye OS in IP cam mode?
A Pi4 with 4 Eyecams for 360 degree.

Going to be a busy xmas break.
Sorting the videos into folders - car, truck, dog, human, kangaroo?
This is real Edge AI.
Interesting that big images are not that much slower.
Wonder how it would go with number plates?
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

User avatar
jbeale
Posts: 3644
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

Re: Image recognition - what 4GB of memory can do

Sat Dec 21, 2019 7:53 am

Fell down this rabbit hole this evening:
https://discuss.pytorch.org/t/modulenot ... wrap/61621

obscure error message turns out actually meant in my case, "don't try to run 64-bit programs on 32-bit OS"
I had switched back to standard Raspbian for other reasons, to try out the builtin RealVNC server which I hadn't played with before.

Anyway just a word to the wise, if you want to play around with other people's deep learning code, you'll likely want to be running a 64-bit OS, because pretty much everyone in that field is. Ubuntu 64bit seems to work OK.

User avatar
Gavinmc42
Posts: 4502
Joined: Wed Aug 28, 2013 3:31 am

Re: Image recognition - what 4GB of memory can do

Sat Dec 21, 2019 9:40 am

if you want to play around with other people's deep learning code, you'll likely want to be running a 64-bit OS, because pretty much everyone in that field is.
Yep, I discovered that over a year ago, AI is using 64bit tools.

Building a Gentoo64 OS right now, based on the Lite version with a desktop.
https://github.com/sakaki-/gentoo-on-rpi-64bit
https://github.com/sakaki-/gentoo-on-rp ... Lite-Image

The Ubuntu server version with Desktop seems much bigger and less up to date than Sakaki's Gentoo64.
Plus Sakaki's wikis are very good and show how to make a personal version of Gentoo64.
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

User avatar
Gavinmc42
Posts: 4502
Joined: Wed Aug 28, 2013 3:31 am

Re: Image recognition - what 4GB of memory can do

Sun Dec 22, 2019 11:12 am

Yolov3 compiled but Gentoo64 gave me "segmentation fault" in x11 when running detect.
It did not when run in headless mode.

Got a bit distracted by playing with Openbox and x11 python shader coding.
Trying to do OpenGL without x11.

Need to learn a lot about this stuff.
Both recog and windowing managers.
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

User avatar
jbeale
Posts: 3644
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

Re: Image recognition - what 4GB of memory can do

Tue Dec 24, 2019 8:26 am

I've now made about 4000 detections using Yolo-v3 on my Pi4, feeding it image captures from an IP camera looking at my front yard and the street beyond. It is pretty accurate. Sometimes an elongated nearly featureless (eg overexposed) white shape gets seen as a bird, and it thinks a yellow diamond shape warning sign on the street saying "BUMP" is a stop sign. However it correctly identifies a real stop sign mounted on the side of a school bus going by, even rather small and viewed from a steep angle. It sometimes detects one particular large SUV twice as being both a car and a truck, but I can sort of see where it's coming from there. The bottom line is that when there is a fully visible object in my image in the "known" category, Yolo identifies and locates it accurately nearly all the time (> 99%). It can even find items with only a small portion (< 25%) visible, but I haven't checked how reliable that is. Anyway in my opinion it is overall much superior to various programs I tried a few years ago; this object-detection field really moves fast.

User avatar
Gavinmc42
Posts: 4502
Joined: Wed Aug 28, 2013 3:31 am

Re: Image recognition - what 4GB of memory can do

Tue Dec 24, 2019 11:42 am

I've now made about 4000 detections using Yolo-v3 on my Pi4, feeding it image captures from an IP camera
That's cool.
Are you using Raspbian lite?

MotionEyeOS has an IP camera mode, so I already have cameras in place.
I was not expecting good CV on the Pi4 this year.

Have you tried Yolo Tiny?
Some suburbs/streets don't like trucks, wondering if this could be used to prove to council that actual number.
Counting manual is a pain.
A statistical graph would be interesting.

I need to stop having fun making a personal Gentoo64 OS and get back to Darknet.
What commands did you use to get a result, my darknet commands just seems to sit there doing ?
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

User avatar
jbeale
Posts: 3644
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

Re: Image recognition - what 4GB of memory can do

Tue Dec 24, 2019 4:34 pm

Gavinmc42 wrote:
Tue Dec 24, 2019 11:42 am
Are you using Raspbian lite?
...Have you tried Yolo Tiny?
... What commands did you use to get a result, my darknet commands just seems to sit there doing ?
I switched back and forth, but currently on Ubuntu 64 to permit playing with other DNN code that expects a 64 bit environment.

Yolo Tiny misses a lot, and the bounding boxes are rarely accurate, so I find it frustrating. The image comparison in my first post is a typical result, and it shows the difference. Full Yolo v3 performs much better and for me is well over the threshold into "usable".

Here's a concrete example on this image: https://github.com/jbeale1/detect/blob/ ... 00_586.jpg

Code: Select all

Yolov3 (Full) DH5D_191219_102000_586.jpg: Predicted in 3.496029 seconds.
detected class = truck : 92.0%
detected class = car : 54.6%
detected class = person : 99.0%

Yolov3-Tiny: DH5D_191219_102000_586.jpg, #Nothing
Full yolo is pretty sure the delivery van is a truck (92%) but thinks also possibly a car (55%). The bounding bounding boxes were nearly identical, I could filter that out if needed. It's quite sure the delivery guy is a person at 99%.
But: Yolo-Tiny saw nothing at all in that image above 50% confidence (which is a needed cutoff as both versions become quite unreliable below 50%) so it's not too useful.

Original Yolo-v3 implemented in the darknet framework from pjreddie.com does not have a batch mode, just a command line where you enter a single file name, or if you invoke without the filename it interactively prompts you for an input image, one at a time. It is also pretty slow, like > 1 minute per frame. The -NNPACK variant linked below is >10x faster on the Pi4 (I am seeing 3.5 sec per 1280x720 frame) and includes a python script to run darknet using subprocess.Popen() and drive it through the STDIN pipe with frames grabbed from a webcam. This is a bit of a hack. I modified that python file for Python 3, and to work in batch mode iterating over all .jpg files in a directory. The python docs warn against doing I/O this way on a persistent process due to deadlocks, I think you're supposed to use ports for interprocess communication. Anyway I got it to work for me, YMMV. I also modified the examples/detector.c code to output the bounding box geometry as text so I can extract crops with Imagemagick. If you're curious, I started with the NNPACK variant here: http://funofdiy.blogspot.com/2018/08/de ... -real.html and added the crude hacky code at https://github.com/jbeale1/detect but this is far from a finished project, you'd need to piece it together.
The code that loops on "Enter Image Path: " is in that same detector.c file, so you could also rewrite that code to add a batch mode. That might be a cleaner way to go than the Python-subprocess thing.
Last edited by jbeale on Tue Dec 24, 2019 9:15 pm, edited 1 time in total.

User avatar
jbeale
Posts: 3644
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

Re: Image recognition - what 4GB of memory can do

Tue Dec 24, 2019 6:57 pm

Further on the Yolo-v3 (full) accuracy: looking through a set of 800 frames triggered by motion detection (so there should be something there) and checking those where no objects were detected, there are just a few failure modes, and they are almost always at night:

1) where the only part of a car visible is a white blob of a headlight, obviously hopeless here
2) strangely altered contrast in infrared mode, where foreground and background lack texture

During the day there were only two failing frames:
1) where just the back half of a UPS truck was visible and its outline was also partly blocked by tree branches, and
2) a medium-distant squirrel in mid-leap, that looked more like a smudge.

User avatar
Gavinmc42
Posts: 4502
Joined: Wed Aug 28, 2013 3:31 am

Re: Image recognition - what 4GB of memory can do

Wed Dec 25, 2019 2:17 am

Thanks John, saved me going down some dead ends.
Finding time to try this stuff is getting harder.
Full YoloV3 and NNPack sound like the place to start.
3.5 seconds is probably fast enough for our camera type apps.

Any difference on smaller memory size Pi4's?
I can see this becoming next gen MotionEye OS or Pikrellcam.
I have not tried the Pi cameras on a Pi4 yet in 64bit mode.
The VC4 blob based h.264 motion detect that Pikrellcam uses probably won't work on Pi4.

Did you install OpenCV first?
Tensorflow can also use Darknet via Darkflow.
I have played with Tensorflow Lite but Pi4's might be able to use full TF?
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

User avatar
jbeale
Posts: 3644
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

Re: Image recognition - what 4GB of memory can do

Wed Dec 25, 2019 3:25 am

Yolo has been run on many different frameworks but so far I've only tried the two versions I mentioned above. You don't need OpenCV and in fact I was unable to get it to compile with it, at least with the current version of OpenCV 4.2.0 it has incompatible requirements. The only use for OpenCV with Yolo/darknet would be for video input and/or output, but with the Pi4 it's not realtime anyway. For still image processing, it works as-is.

Of the two versions of the code I tried, the one with NNPACK is the clear winner. That one uses about 58% of available memory on a Pi4 4GB, so there is no other model that will run the full Yolo-v3 w/NNPACK code. If running this application faster is important, the Nvidia Jetson Nano board (about $100) apparently runs full Yolo about 7x faster than the Pi4. However the Pi4 speed is OK for the kind of playing around that I'm doing now. I've now processed about 6000 images with 9000+ detected objects. It suspects one particular black shaggy dog on the street is really a bear, but it's mostly pretty sensible.

User avatar
Gavinmc42
Posts: 4502
Joined: Wed Aug 28, 2013 3:31 am

Re: Image recognition - what 4GB of memory can do

Wed Dec 25, 2019 8:42 am

Whoops was compiling and testing on a 2GB Pi4.
My one 4GB is my desktop now, needs to swap them around

Pikrellcam generates a thumbnail, use that to decide to save or delete the video?
Any advantage in having a smaller number of categories?
Truck, car, person, bike, dog and then the rest lumped in unknown?

Wondering what training will be needed for that robot lawnmower that been on my to do list for 4 decades.
Dog, people, tree, bush?
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

User avatar
Gavinmc42
Posts: 4502
Joined: Wed Aug 28, 2013 3:31 am

Re: Image recognition - what 4GB of memory can do

Wed Dec 25, 2019 9:12 am

Yippee, had to use tiny and it took 12 seconds but it worked :D
Does not seem to matter if I am using my lite x11 desktop or headless.

Edit - Multiple versions of darknet , now have a 3.5sec tiny version :D
I thought the full version was broken, nope, it just took 76secs, but more accurate.
Somehow it is not optimised, not surprising as I had install issues.
Generally Gentoo64 compile options are faster, i suspect the makefile needs a reconfigure.
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

User avatar
jbeale
Posts: 3644
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

Re: Image recognition - what 4GB of memory can do

Wed Dec 25, 2019 6:50 pm

76 seconds is what I got for pjreddie.com' "original" full Yolo v3. The -NNPACK version should go MUCH faster; if you are getting 76 seconds, something is not working I think. I followed each of the instructions at http://funofdiy.blogspot.com/2018/08/de ... -real.html except that on a Pi 4 with gcc 9.2.1, when making darknet I got the error: unrecognized command line option -mfpu=neon-vfpv4 but it works if I change that in the Makefile to -mtune=cortex-a72

I'm not completely clear on the meaning of either of these flags, but the bottom line is that it worked.

User avatar
jbeale
Posts: 3644
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

Re: Image recognition - what 4GB of memory can do

Thu Dec 26, 2019 3:36 am

After scanning about 8000 images, here is a rare false-detect for a person. Full Yolo-v3 sees this small detail from a night scene (headlight glare off a car side panel + wheel rims, seen nearly head-on) as a person with probability 53%. (If you squint your eyes I guess you see a ghostly skull and arms?) Most real detections are above 80% so I should probably raise my threshold from the default 50%, and also require detections to be a certain number of pixels in size (this is a 60x198 crop of a 1920x1080 frame)

Code: Select all

/home/pi/yinput/dh3_2019-12-21_07.24.41_2838_084.jpg: Predicted in 3.619190 seconds.
detected class = person : 53.4%
dh3_2019-12-21_07.24.41_2838_084_person_1.jpg
dh3_2019-12-21_07.24.41_2838_084_person_1.jpg (4.68 KiB) Viewed 3492 times
for comparison, here are two correct person detections. The smaller one was at 63.6% and the larger one at 99.8%
dh3_2019-12-24_16.18.51_5765_082_person_5.jpg
dh3_2019-12-24_16.18.51_5765_082_person_5.jpg (5.78 KiB) Viewed 3373 times
dh3_2019-12-21_10.47.40_2916_084_person_6.jpg
dh3_2019-12-21_10.47.40_2916_084_person_6.jpg (18.33 KiB) Viewed 3466 times
Last edited by jbeale on Thu Dec 26, 2019 4:11 pm, edited 2 times in total.

ejolson
Posts: 5150
Joined: Tue Mar 18, 2014 11:47 am

Re: Image recognition - what 4GB of memory can do

Thu Dec 26, 2019 3:56 am

jbeale wrote:
Thu Dec 26, 2019 3:36 am
After scanning about 8000 images, here is a rare false-detect for a person. Full Yolo-v3 sees this small detail from a night scene (headlight glare off a car side panel + wheel rims, seen nearly head-on) as a person with probability 53%. Most real detections are above 80% so I should probably raise my threshold from the default 50%.

Code: Select all

/home/pi/yinput/dh3_2019-12-21_07.24.41_2838_084.jpg: Predicted in 3.619190 seconds.
detected class = person : 53.4%
dh3_2019-12-21_07.24.41_2838_084_person_1.jpg
That's clearly neither a car nor a person, but, in fact, a space alien. Rather than increasing the the recognition threshold beyond 50 percent, it might be better to increase the training data to include the full Area 51 space-alien gallery.

Along these lines, how hard is it for a user to extend Yolo-v3 with additional images and categories for deployment in a new or domain-specific environment?

User avatar
jbeale
Posts: 3644
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

Re: Image recognition - what 4GB of memory can do

Thu Dec 26, 2019 4:12 am

ejolson wrote:
Thu Dec 26, 2019 3:56 am
how hard is it for a user to extend Yolo-v3 with additional images and categories for deployment in a new or domain-specific environment?
That is certainly possible, but I have not done so yet. Here is one guide on how to do it:
https://blog.insightdatascience.com/how ... 4d10e55de2

From what I have read, it is best to use a high-end GPU (eg. via rented online cloud server, if you don't have a good one yourself). You also need a collection of labelled images from your specific domain, and the more the better. I think YOLO was originally trained on the COCO image dataset with 164 thousand images.

User avatar
Gavinmc42
Posts: 4502
Joined: Wed Aug 28, 2013 3:31 am

Re: Image recognition - what 4GB of memory can do

Thu Dec 26, 2019 7:45 am

Yep that's Gentoo64's default -mtune=cortex-a72
I noticed those tuts used CLang so that's another compile option.
That fact I got it working without the a72 option at all shows the code is clean.
NNPACK has a make with a NEON option, compiling normal Darknet with that now.
Rats, 77secs.
Now I have to figure out that peach.py and confu stuff to get nnpack working

Been watching Yolov3 YT's to get up to speed, came across Idein using Darknet which rang a bell.
https://github.com/Idein/py-videocore6

Darknet uses Cuda which we cannot use and there is no OpenCL for VC6 yet.
I did see Arm's Compute Library get mentioned and that was one of the first things I ever compiled (with Sakaki's help) in Gentoo64.
Can py-videocore6 be used for more speed?

Edit - OPENMP=1 makes a small speed increase and CPU usage goes from 100% to ~380%, showing the 4cores are being used.
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

User avatar
Gavinmc42
Posts: 4502
Joined: Wed Aug 28, 2013 3:31 am

Re: Image recognition - what 4GB of memory can do

Thu Dec 26, 2019 10:37 am

I had swapped my Pi's around to run Darknet on the 4G and this Gentoo64 on the 2G.
Whoopsie, Browser was really slow, turns out I had started testing Darknet on the Pi4B 1GB :oops:

Now I have Darknet running fine (but the slow 70sec) on the 2GB Pi4.
The Pi4 1GB actually did work but took 403sec :o
Which is why I thought it crashed, I did not wait long enough.
Top is useful to see if it is still running.

I don't have a working NNPACK version yet but it might work on the 2GB Pi4 as well
Might have to ID my Pi4's better.

Not sure why Peach.py is needed, seems to be x86 assembler?
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

Return to “General discussion”