Im struggling a little with the face recognition controls.
First of all, the cognitive face control works pretty well, but I would need some way to reset or unlearn faces if for no other reason as to test my scripts when my bot sees a new face for the first time. I have resorted to using family pictures, but by now he knows every picture I have at hand and most where recognized even before I trained them (who knew my brother was Johnny depp?) I even used some 3d printed face mask I printed a while ago, and yep, its positively recognized, someone else beat me to it lol.
While this is kinda fun, its also annoying when I cant turn it off, so is there a way to run this "in a sandbox", using only my own data, be able to reset everything it learned, and not have faces recognized submitted by other people?
When using the camera plugin, face tracking works reasonably well (it does struggle with faces at an angle and particularly from the side). But using a face as object for object recognition is useless. So the only way Ive found so far for the robot to recognize who he is talking to, is using face tracking as a trigger and cognitive face for identification. This makes it difficult to detect a new face or multiple faces, if every time tracking is restarted, I would need to perform a cognitive face lookup. There is daily limit to that. And then there are the false positives.
Any other suggestions?
Did some more reading and googling. Adding an omron HVC-P2 would probably be the most powerful solution, but not a cheap one and the ability to have the detection and processing onboard, when I need a wifi connection to my PC anyway, seems a little wasteful.
There are countless API providers for face recognition, but they all impose limits/charge fees, and wont run locally or offline.
So I came across this: https://github.com/ageitgey/face_recognition
I have no tested it yet, but it provides offline/local face recognition from a command line. Seems very simple to use, you just provide it a jpg and it will search for a matching face in a folder with named pictures. Perfect for my purposes. Only mac and linux is offcially supported, but there are windows instructions and they do provide a VM or I could run it on a Pi. Interfacing with EZB should be a breeze, it just reads a jpg (snaphot) from disk, but triggering it and get results back to ezb, as well as adding new faces will require a plugin AFAICS, and Im not sure Im able to pull that off.
Use OpenCV in a plugin. There’s a very well supported offline face defect library built in. The OpenCV wrapper I recommend for ARC skill plugin available via nuget is emgucv
Lots of example source available via google
Here’s plugin tutorial: https://synthiam.com/Tutorials/UserTutorials/146/1
Here’s a very detailed emgucv tutorial that pretty much does all the work for you: http://ahmedopeyemi.com/main/face-detection-and-recognition-in-c-using-emgucv-3-0-opencv-wrapper-part-1/
All you’d need to do is create the template of an ARC skill plugin, attach to the camera to receive latest image frame, and process it. Add some buttons so users can customize their configuration, etc.
You can subscribe to the cameras tracking event and have the plugin operate like a tracking method but returning coordinates of the detected object (face). That way the ARC camera control does the heavy lifting for servo tracking and scripts, etc.. Means your plugin would merely only need to detect.
Thanks, that looks interesting, but will take me some time to digest. I had already begun reading the plugin tutorial, and kudo's, its very well written, to the point where I think I might even manage (despite never having programmed much if anything - aside from arduino C, some PHP and well, basic on a trs80. Oh and cobol back in uni. Am I showing my age ?
Adding opencv to that is going to stretch this to my limits, but hey, it seems like a good challenge and opportunity to learn.
Haha - nah, age is merely a number. Age++
One great thing about the community is no one is alone in their endevour - everyone's listening, even me. So if you start creating that plugin, remember that you can ask me or others (i.e. ptp) for assistance. I'm a decent programmer, but i'm not great. People like PTP are great programmers - i'm merely capable lol
Oh, Im gonna need help. In fact, Im may need a brain upgrade as object oriented anything pretty much always causes syntax errors in my head. I tend to understand the most basic examples, but anything beyond that, my biological interpreter struggles with.. whatever was wrong with procedural programming? . But Ill try
You know - I had to go through that as well - the object oriented relearn part, years ago. The thing is, once it CLICKS.... it just makes sense and you never want to go back lol. But the breaking point for it to click is the hardest part. I felt dumb and incapable for such a long time when trying to learn object oriented programming until one day i woke up and it all made sense. Now i can't think about it any other way!
Im already stuck on step 4 just trying to follow the tutorial. Probably due to a newer version of VS. In step 4 Im supposed to add a new windows form, but I dont see that option:
The closest thing is the inherited form, but that fails because there is nothing to inherit from.
Anyway, just found a link to download VS2015 Ill try with that. Might be worth updating the tutorial and either link to VS2015 (https://go.microsoft.com/fwlink/?LinkId=532606&clcid=0x409) or maybe update it for VS2017 one day
Edit: no problems so far using VS2015
@vertigo:
Visual Studio 2017, maybe something is missing on your setup ?
DJ: Thanks for the kind words.
ALL: OpenCV is a great library but you need a wrapper (managed .net dll) to use with .net project.
Emgu is a well known wrapper but my recommendation is to stay away, due to their licensing model:
Their "free" model is GPL 3:
GPL3 forces open source code, empowers the application/end user to have the right to access the source code. This is a good idea (noble), but, is not compatible with commercial software.
https://opensource.stackexchange.com/questions/2338/can-i-use-gpl-libraries-in-a-closed-source-project-if-only-the-output-is-distrib
Another example you are not allowed to publish a GPL3 application to the Apple store even if the application is free.
https://apple.stackexchange.com/questions/6109/is-it-possible-to-have-gpl-software-in-the-mac-app-store
If you plan to build a plugin you can open source the plugin source code right and is ok ?
NO that is not enough.
https://opensource.stackexchange.com/questions/4431/making-a-commercial-plugin-for-a-gplv3-software-without-releasing-the-plugins-c
An ARC's plugin is not a separated application this means you can't use a GPL3 library with an open source plugin used within the same process (ARC closed source code commercial application).
EMGU is very popular easy to use, a lot of blog posts, a lot of students use the wrapper for final projects but i have doubts they understand the real implications of using a GPL3 library.
I know about candy Wrappers, reading this post is giving me a headache. it is like the ceiling over my head confused
Hmm, thanks for pointing that out PTP. I guess the next question then is: now what?
Maybe I should get back to my previous idea, of using ageitgey/face_recognition? His program is licensed under MIT license and based on dlib which has a cool license; I quote:
Its not going to be as neatly integrated, but probably easier for me to pull off.
as for VS2017, its possible I didnt install some components. The installation procedure asked me a lot of things I had no answer for, so I just guessed
an alternative to EMGU (wrapper) : https://github.com/shimat/opencvsharp
Regarding dlib and other Machine Learning frameworks/Libraries e.g. Tensorflow, Yolo (Darknet) the main problem is to compile/obtain a x86 version.
Some wrappers only handle the Inference (Detection).
Training is sometimes a complicate and not obvious task, you need to master a few tools/scripts.
Then you have different models: CoreML (Apple), Tensorflow (Google), Windows ML, Onnx (Open Format Exchange).
And once again you have more tools to convert.
These tools are available for integration, research no one (big player) is interested in developing a final (consumer) and offline product for free.
Maybe that is one of the reasons why everyone (Watson, Azure, Google Cloud, Amazon, Facebook ) is pushing cloud services.
I'm investing some personal time to understand the landscape, it's a very interesting subject (ML).
thanks, but I think Ill throw the towel for now. I have never used C sharp, I dont know VS (as you noticed, I cant even install it properly lol). Ezscript is within my grasp I think, but compiling plugins in an IDE I dont know that integrate external wrappers to use a library I known nothing about, .. its too much stuff where I dont know what Im doing and dont have enough things to copy paste.
Im gonna play with that dlib app in a VM or Rasberry and if it works well, making a plugin that just writes a jpg and reads back a result may be doable for me. Maybe someone more steeped in windows development will one day write a opencv plugin.
Thanks ptp - didn’t notice the rest of the licensing mention for emgucv
Vertigo, adding the form or other steps of the tutorial process hasn’t changed in newer visual studio versions to set your mind at ease. The one thing I do recommend is following along with the video from this step of the tutorial here: https://synthiam.com/Tutorials/UserTutorials/146/2
The only thing is you have to hear my voice the whole time lol. I find pausing and playing to follow a video much more intuitive than following written instructions - because you can see the outcome of each action. Also, if you follow the exact clicks, you’ll get the exact outcomes