One of my friends came up with an interesting problem - Assume that we have a set of images in the system. Now, some one might submit a new image by slightly modifying any of the images already submitted, and in that case, the system should report that the submitted image is a forged image.
I can think about two solutions.
Solution 1 - Do an image comparison (bitmap based) for each input image with the given images in the database, probably after converting them to gray scale to counter color changing tricks, and after resizing them to a standard size.
Solution 2 - Create a Self Organized Map and train with all the existing images. And if some one submits an image, if it has a close match, report it as forged.
It might not be possible to have a system with more than 90% accuracy. Please share your thoughts/suggestions/solutions.
Edit after going through few answers: I already have a backprop neural network and an xml based language to train neural networks here - http://www.codeproject.com/KB/dotnet/neuralnetwork.aspx
I'm looking forward for specific answers for the problem I described above.
Thanks
Good question, but depends on how much code you want to write. What if I mirror/flip an image, cut&paste with-in images. When you solve this problem, you've cracked most CAPTCHA too?
If you have alot of horsepower and programming man-hours you might want to look at Forier Transformations and Historgams to find matches. This would identify flip/mirror copy/paste.
Then create lots of fragments of tests, like unit tests(?) for things like "can this bit of image be found in the source" "can this bit when hue-rotated be found" etc etc.
Very open ended problem
Guess you can start with Image Recognition with Neural Networks.
Basically I think it covers your Solution 2 approach. At least you'll find useful guidance for Neural Networks and how to train them.
There is certainly a trade-off between performance and accuracy here. You could use neural networks but may need some pre-transformations first: e.g. http://en.wikipedia.org/wiki/Image_registration.
There are several more efficient algorithms like histogram comparison. Check The segmentation article at Wikipedia: en.wikipedia.org/wiki/Segmentation_%28image_processing%29
I think the simplest solution would be to simply invisibly digitally watermark images that are already in the system, and new images as they are added.
As new images are added, simply check for traces of the digital watermark.
No offense, but this might be a "if you only know a hammer, every problem looks like a nail"-type of situation. Artificial neural networks aren't a good solution for everything. If you simply calculated a pixel-by-pixel mean squared difference between the stored images and the "forge candidate", you could probably get judge image similarity more reliably.
I'd also suggest resizing all images to e.g. 50x50 pixels and performing a histogram equalization before comparing them. That way you could ignore image resizing and global brightness contrast changes.
After some research, I've decided that the best way is to use the Self organizing maps (SOM) approach.
The idea is to self train the SOM network initially with the available/valid images, and then when a new image is inserted, find the nearest images and if matches found under a threshold, report the same.
AForge is an excellent library with SOM support (http://code.google.com/p/aforge/)
Information on basic SOM here
A good read on SOM here
Related
I have thousands of jpegs in a folder structure. These images are a snapshot of my driveway in 2560 x 1440 and are taken and stored every 60 seconds.
I'd like to create a program that can detect, from analyzing an image, whether I or my wife, was home at that particular time or not. I have a red car, she has a bright yellow car. So a simple color threshold should probably suffice. Another clear distinction is that we both have our own spot and never park in the others. Also, other people don't use the driveway (and if they do, I don't mind a false positive). One minor complication is that the camera's switch to black/white during the dark (but that may be when the parking spot rather than the color might come in handy).
So I was hoping I could use ML.Net and train a model with some hand-annotated images where I tag the image with data whether I see my or her car in the driveway. I was thinking of annotating maybe a 100 to a couple of hundred images for day and another set for night and feed all these images to ML.Net to train it and then have analyse a few 100 images where I can manually check the results and correct any mistakes and then create a sort of feedback-loop to train on a few hundred more images.
Once the training is complete I'd like to analyze all images currently stored and each new image as it comes in to generate some data on when I'm (or my wife is) home, away etc.
My problem is (and this is probably going to be the reason for the question being closed as "too broad" or something): I have no clue on how to do this. I have seen awesome tutorials that all make it seem like child's play but when I then try to do this in C# (my language of choice) and look for ML.Net Howto's I can't seem to find anything that helps me in the right direction.
For example: Train a machine learning model with data that's not in a text file. I'm a competent programmer so it's peanuts to create CSV file / database / whatever that has 1.jpg -> rob home, wife not home data. But the "How To" doesn't explain how to feed the image into ML.Net and I haven't been able to find anything that does. Most probable cause is that I'm new to ML(.Net) and probably that I'm too stubborn to give up trying to accomplish this in C# but the information available is, weird as it sounds, overwhelming but also scarce. The information available usually leads me going down some rabbit hole only to find out after way too long that it's not what I want or I can't find anything that hints of me going in the right direction.
So long story short; tl;dr:
How do I feed images into ML.Net, how do I tell ML.Net that my/her car is in the driveway for any given image (training) and how do I get ML.Net to tell me whether it thinks I'm / my wife is home or not for a given image? Or is this not possible (currently)? I'm NOT looking for complete code but for pointers, hints, links, tutorials, examples or whatever may help me in the right direction.
you might find something usefull here Image recognition/classification using Microsoft ML.net 0.2 (Machine learning)
However I would encourage you to consider python as weapon of choice for your task.
Here you would just store the data in different folders according to the label, you #home, your wife #home, both #home, no car in the drive way, other
and you are ready to go.
https://blog.keras.io/building-powerful-image-classification-models-using-very-little-data.html
It probably won't take you more than a weekend, and thats inlcuding to learn the bacics of python.
Edit:
I seems as it still does not support to train image classification tasks using ML.Net: "Again, note that this sample only uses/consumes a pre-trained TensorFlow model with ML.NET API. Therefore, it does not train any ML.NET model. Currently, TensorFlow is only supported in ML.NET for scoring/predicting with existing TensorFlow trained models."
There is a thread about it here https://github.com/dotnet/docs/issues/5379,
What you could try is uses: http://www.emgu.com/wiki/index.php/Main_Page in combination with OpenCV, this https://www.geeksforgeeks.org/opencv-python-program-vehicle-detection-video-frame/ is an example in python but it should translate well to c++ or c# using emgu. Once the car is detected check for the position and color. This approach would probably also avoid labeling any data.
Alternatively use a pre trained model h5 file and load into ML.Net then check for the position and mean color to check whos car it is.
I am trying to create a game but before that i am creating all the graphics that will be used in it but here is the problem.
Problem
The current games graphics size is 50MB and might increase as all the graphic work is not done yet and it is not possible to load 50 MB every time when the user runs the game. So, please tell me this if it is possible to downloaded all the graphics on the first run and use it again when the user runs the game again?
If yes then please help me by giving a piece of code snippet or any article related to it. Platform : ASP.NET
Take advantage of all the different caching mechanisms:
Http Caching. You may read more about it here. Especially the section "2. Expires"
HTML5 has the concept of local storage and you can possibly take advantage of that as well. You can read more here.
Try and compressing the graphics. You can read more here. Especially the section "Minimize payload size".
Good luck and hope that helps.
You can download all the graphics on the first run & cache it. This will improve the performance tremendously.
Best practice is to use a CDN/Cache Server.
Refer to the following article for catching: Link & Link
Hi everyone,
I'm working on a path finding application in C# and I've run into a problem before I even start looking into coding the path finding aspect. The application will allow a user to place a marker on the map of the building then show the user the nearest exit from that position. I have the maps of the building I need but I'm not sure if I can use them straight away as jpeg images.
Would I be able to use the maps as they are or would it be better to remake them in a grid format so its all split up into squares? I'm thinking it may be easier to code the path finding aspect if the maps were made up of squares in a grid but it may take some time to remake the maps in this format.
Any advice is greatly appreciated, I do have experience in C# but path finding is a fairly new subject to me so I'm not sure of the best format for the maps to be in.
Thanks in advance!
Well, if you can afford some manual data processing, the best way would be to simply build a graph of the aisles and store it. You can then use simple graph search algorithms to find the nearest exit. Even spliting it into a grid is an overkill.
I've used this before to build graphs of aisles and stores in commerce buildings, and it's very useful and simple to implement.
I have a lot of small pictures to store and these are pictures users can change very often.
The images have an average of 50Kb - 150Kb. Let's say I have 5000 of these images. Will FTP get unmanageable in the end or will a MsSQL database get to much load giving a normal webpage might use 25 of these images.
What technique should I choose? By the way, in my case im using a hosting solution consisting of a webfarm.
You might want to look at hosting these images on a CDN or similar. Take what SO use as a good example, imgur.
I'm thinking the performance and user experience would take you a long time to match. You might want to store some reference of the images as well.
Of course this may not be an option to you then I'd still put your images on a sub domain of your site, that is setup to deliver static content, again look at how SO do it for an detailed example.
I am looking for a solution (APIs, etc.) for handling a similar experience as cafepress.com. I need to be able to upload images (preferably multiple at a time) and be able to map my uploaded images to various product images (clean stock images of shirts, mugs, etc.). I also want to give the user some very basic controls over the images they upload such as cropping, resizing, levels, etc. Any suggested libraries or APIs would be greatly appreciated. I am looking for .NET solutions (if server-side). I am not looking for how to tie this all together but rather some suggested libraries or tools to build out some of this functionality.
Note: If this is not the place for this type of question, please move accordingly or suggest an alternate site.
Frankly, I don't think you are going to find what you are looking for specifically, unless you are looking at using a full on CMS of some form. Frankly, those problem domains are too far apart. Instead you should probably look at them as individual pieces.
So far as upload controls exist, there are probably close to 100, some free some not so free. Personally, I already have a Telerik subscription, so it was a no-brainer for me, but Rad Upload works well and supports multiple uploads. Free implementations are available.
The cropping and post image handling tasks ( at least the ones you have listed ), can easily be handled using standard System.Drawing.* calls, or if it gets more advanced a ton of free libraries exist, like the age old ImageMagick, but there are a number of commerical libraries available as well. Chances are though, the inbuilt libraries will be more than sufficient.
Finally the mapping to products should be handled by your business layer ( aka, code you write ) as it is going to be so specific to your app.
However, if you are looking for a storefront or CMM with a multiple image upload control, that is a very different question with many options as well, both free and commercial.
use openCV. you can find it here: http://opencv.willowgarage.com/wiki/
you can use this library perfectly with c++.
if you need to use it in C# use this wrapper: www.emgu.com/wiki/index.php/Main_Page