Can a single image be a positive example for multiple classes? - ibm-watson

Bouquets of flowers are a fairly accurate analogy for our problem domain, and we have another S.O. question out there asking about the feasibility of a different approach to our problem/goal.
What if, rather than making classes by flower types, we made our classes according to the actions we need to take depending on the contents and complex combinations of the bouquet?
Let's say that, if in the bouquet in our test image, there are:
>9 roses, >14 pansies, <1 marigold, any qty of other flowers
then we need to take, both, action-a & action-d.
So, then, the same image would be used as a positive example for both class action-a and class action-d.
Inversely, there would absolutely be positive action-d examples which would be negative action-a examples, and vice versa.
Of course, even with this simplification it still gets quite complex.
I imagine this approach would need a huge number of training images.
Even still, I'm hopeful that it might work.
Thoughts?

Yes, you can have the same image in >1 classes inside 1 classifier, as long as you have >=10 unique images per class AND >=20 total unique images in the classifier in total, including any negative_examples.
However, you should be careful about what you are "teaching" the system by doing this.
Classes within a classifier are meant to be mutually exclusive. Internally the system is trying to figure out what makes the positive examples of one class different from all the other examples in a classifier's training data.
If the system discovers an exact duplicate of an image file in more than one class of a single classifier , it will use it as a positive example of both classes. Exact duplicates are determined by the check sum of the image file.

I think you are on right path. but u have to make sure that u have enough no of images for training and no. of flowers in each image should be clearly visible.
Try it

Related

Measure difference between two files

I have a question that's very specific, yet very general at the same time. (Also, I don't know if this is quite the right site for this.)
The Scenario
Let's say I have an uncompressed video vid.avi. It is then run through [Some compression algorithm], which is lossy. I want to compare vid.avi and the new, compressed file to determine just how much data was lost in the compression. How can I compare the files and how can I measure the difference between the two, using the original as the reference point? Is it possible at all? I would prefer a generic answer that will work with any language, but I would also gladly accept an answer that's specific to a language.
EDIT: Let me be more specific. I want something that compares two video files in a similar way that the Notepad++ Compare plugin compares text files. I just want to find out how close each individual pixel's colour is to the original file's colour for that pixel.
Thanks in advance, and thank you for taking the time to read this question.
It is generally the change in video quality that people want to measure when comparing compression methods, rather than a loss of data.
If you did want to measure somehow the data loss, you would have to define what you mean by 'data' and how you wanted to measure it. Video compression is quite complex and the approach may even differ frame by frame within a video. Data could mean the colour depth for each pixel, the number of frames per second, whether a frame is encoded based on a delay to other frames etc.
Video quality is subjective so the reduction in quality after compression will not be an absolute value. The usual way to measure the quality is similar to the technique used for audio - Mean Opinion Score: https://en.wikipedia.org/wiki/Mean_opinion_score. Its essentially uses a well defined process to try to apply some objectivity to a test audiences subjective experience.

pybrain image input to dataset for Neural Network

I'm trying to write a neural network that (after being properly trained) identifies certain road signs and returns a different output for each type of sign.
Before I started to train my network, I noticed on the pybrain website that their datasets are always an array of values, each entry containing an input and a target. The images I have for my NN have been converted to grayscale pixel data (a simple array of numbers). To train each set of data, do I need to somehow add a target value for each pixel? And if so, how would I go about doing that?
QUICK ANSWER
No, you don't need target for every single pixel, you treat pixels from single image as your input data and you add target to that data.
LONG ANSWER
What you trying to do is to solve classification problem. You have image represented by array of numbers and you need to classify it as some class from limited set of classes.
So lets say that you have 2 classes: prohibitions signs (I'm not native speaker, I don't know how you call signs that forbid something), and information signs. Lets say that prohibition signs is our class 1 and information signs is class 2.
Your data set should look like this:
([representation of sign in numbers], class) - single sample
After that, since it's classification problem, I recommend using _convertToOneOfMany() method of DataSet class, to convert your targets into multiple outputs.
I've answered similar question here, go check it out.

Advice for Object Detection on Embedded System with no non-standard libraries

I am looking for some advice for a good way to detect either square or circular objects in an image. I currently have a canny edge algorithm running on the original greyscale and I can produce this output:
http://imgur.com/FAwowr1
Now I can see that there is a cubesat in this picture, but what is a good computationally efficient way that the program can see that aswell? I have looked at houghs transform but that seems to be very computation heavy. I have also looked at Harris corner detect, but I feel I would get to many false positives, for I am essentially looking to isolate pictures that contain said cube satellite.
Anyone have any thoughts on some good algorithms to pursue? I am very limited on space so I cannot use any large external libraries like opencv. (This is all in C btw)
Many Thanks!
I would into what is called mathematical morphology
Basically you operate on binary images, so you must find a clever way to threshold them first , the you do operations such as erosion and dilation with some well selected structuring element to extract areas of interest in your image.

best method of turning millions of x,y,z positions of particles into visualisation

I'm interested in different algorithms people use to visualise millions of particles in a box. I know you can use Cloud-In-Cell, adaptive mesh, Kernel smoothing, nearest grid point methods etc to reduce the load in memory but there is very little documentation on how to do these things online.
i.e. I have array with:
x,y,z
1,2,3
4,5,6
6,7,8
xi,yi,zi
for i = 100 million for example. I don't want a package like Mayavi/Paraview to do it, I want to code this myself then load the decomposed matrix into Mayavi (rather than on-the-fly rendering) My poor 8Gb Macbook explodes if I try and use the particle positions. Any tutorials would be appreciated.
Analysing and creating visualisations for complex multi-dimensional data is complex. The best visualisation almost always depends on what the data is, and what relationships exists within the data. Of course, you are probably wanting to create visualisation of the data to show and explore relationships. Ultimately, this comes down to trying different posibilities.
My advice is to think about the data, and try to find sensible ways to slice up the dimensions. 3D plots, like surface plots or voxel renderings may be what you want. Personally, I prefer trying to find 2D representations, because they are easier to understand and to communicate to other people. Contour plots are great because they show 3D information in a 2D form. You can show a sequence of contour plots side by side, or in a timelapse to add a fourth dimension. There are also creative ways to use colour to add dimensions, while keeping the visualisation comprehensible -- which is the most important thing.
I see you want to write the code yourself. I understand that. Doing so will take a non-trivial effort, and afterwards, you might not have an effective visualisation. My advice is this: use a tool to help you prototype visualisations first! I've used gnuplot with some success, although I'm sure there are other options.
Once you have a good handle on the data, and how to communicate what it means, then you will be well positioned to code a good visualisation.
UPDATE
I'll offer a suggestion for the data you have described. It sounds as though you want/need a point density map. These are popular in geographical information systems, but have other uses. I haven't used one before, but the basic idea is to use a function to enstimate the density in a 3D space. The density becomes the fourth dimension. Something relatively simple, like the equation below, may be good enough.
The point density map might be easier to slice, summarise and render than the raw particle data.
The data I have analysed has been of a different nature, so I have not used this particular method before. Hopefully it proves helpful.
PS. I've just seen your comment below, and I'm not sure that this information will help you with that. However, I am posting my update anyway, just in case it is useful information.

Counting Arcs to Places and Transitions in CPN-Tools

Background: CPN-Tools is a model checker using colored Petri nets, and it uses CPN ML as its query language. CPN ML is an extension of Standard ML, a type-inference functional language.
Issue: CPN-Tools is popularly used to model domains that require state space analysis. I am using it to model a domain where I need to know the number of incoming and outgoing arcs from a place. The difference is that I am looking at the Petri net model representation, not the state space. So when I say counting arcs from a place, I do mean a place, not a state space node. In my research so far, I have come across the CPN'PlaceTable and CPN'TransitionTable structures that contain properties of places and transitions, and look promising to my quest. However, I haven't found any CPN ML examples to help me figure out a way to count incoming/outgoing arcs using these structures.
Question: So my question, or actually questions are:
how do I use CPN'PlaceTable or any other method to count incoming arcs to a given place?
how do I use CPN'TransitionTable or any appropriate method to count outgoing arcs from a given transition?
Case example: I'm using this simple Petri net to give an idea about what I am expecting. Please view this link for the illustration.
In the image, we see 3 places and 2 transitions. What I want ideally is to be able to have CPN ML functions, incoming(place_name) and outgoing(transition_name) that work this way
incoming(Place1) = 0
incoming(Place2) = 2
incoming(Place3) = 1
outgoing(Transition1) = 2
outgoing(Transition2) = 1
Other info: I want to emphasize again that I'm not referring to state space nodes. There's lots of documentation in CPN-Tools about arc properties in state spaces, but I haven't found much information about my said question on the CPN-Tools support forums. And to make matters worse, CPN' structures in general are highly un-documented in CPN-Tools.

Resources