In a neural network when inputting nerve input to sense a 2D environment, how do you differentiate two types of objects (with similar shape and size) so the neural network can treat them differently?

Each neuron in the input layer of a neural network essentially gets 1 dimensional input (range between two values) but 2 dimensional input would be needed to send both collision and category/type information through each input layer neuron. How do you get around that?

Note: After having confusion regarding the scenario / situation I'm asking about compared to other more complex scenarios, and the long comment series that ensued, I'm realizing one challenge of this site is that it's much more complicated and diverse subject matter than code, or the various other topics of Stack Exchange where the problems can be very clearly and simply expressed. Here it's more challenging to express your question and scenario clearly to avoid confusion.

Also there's probably a higher skill gap between an AI learner / enthusiast, and an expert AI specialist, compared to other fields, so that could potentially lead to even more difficulty communicating the answer / question in ways everyone can understand without confusion. Challenging SE site to ask good questions on!

  • 1
    $\begingroup$ Hello, welcome to AI.SE. Please note that implementation questions are off-topic here. $\endgroup$ – Mithical May 17 '17 at 9:45
  • 1
    $\begingroup$ @Mithrandir this is a fundamental question, if this cant be asked this site is useless to anyone interested in AI. $\endgroup$ – J.Todd May 17 '17 at 9:49
  • 1
    $\begingroup$ No, it just has a different scope than you were expecting. $\endgroup$ – Mithical May 17 '17 at 9:50
  • 2
    $\begingroup$ Isn't your input different for different objects? Maybe you should give a bit more details about your input und the task you are trying to accomplish. $\endgroup$ – BlindKungFuMaster May 17 '17 at 11:28
  • 1
    $\begingroup$ I never said that you need two sets of input neurons. The input will be different for different objects, because they are different objects. If the inputs are the same for different objects you should change what your creature perceives. $\endgroup$ – BlindKungFuMaster May 18 '17 at 6:47

Neural networks learn. That's what they are for. For your task there are two sensible scenarios:

  1. You have a fixed reaction for danger and a fixed reaction for food and you only have to learn how to distinguish between them. In that case you basically try to classify the situation to trigger the right fixed response and this classification would be learned by backpropagation.

  2. You directly learn to act for a given situation. In that case you can either use a genetic algorithm or you use reinforcement learning with backpropagation.

I would recommend using a genetic algorithm, because it is significantly easier and also makes sense in this situation. You would randomly initialise your network, let it run around in the environment and remember how much food it ate and how often or how quickly it died. Then you would randomly change the weights of your network and do the same thing again. If it did better this time around you would proceed to use the new weights otherwise you go back to the old weights and try a different random change. By selecting successful random changes it would over time learn to avoid danger and seek out food.

Edit: To my mind you have a fundamental misunderstanding how perception works. If you see a lion and a cake, do those trigger different kinds of cells on your retina? No! All nerve cells are used to detect all kinds of objects! The classification, i.e. whether you are seeing a lion or a cake happens in the neural network i.e. in the higher regions of your visual cortex, far removed from the initial nerve activation. Your lion might be yellow and your cake might be yellow, only if you analyse the high level structure of your nerve inputs can you decide what you are seeing. That is the task of a neural network. And that high level structure analysis is what a neural network learns.

What seems to confuse you is the example you linked. In that example this very sparse distance measuring is enough to differentiate between walls and boosters in your high level structure analysis, because the different points of the walls that you sample have a certain relative position that you can analyse and conclude that they constitute the wall.

In your scenario very sparse distance measuring will not help you obviously. The distance of an object doesn't tell you whether it's a lion or a cake. Distance and color would be a solution to that. Or, more realistically, you have different shapes and much tighter distance sampling, and high level analysis can work out the shape from a couple of closely measured distances.

  • $\begingroup$ I'm using genetic evolution for the learning, but Im having trouble understanding your answer as to how the network actually differentiates the two types of objects. Lets say instead of walls and boosters we just have circles, all the same size. Some circles are good, some are bad. They can be in different positions at any given time, they move randomly (a randomly dynamic environment). $\endgroup$ – J.Todd May 18 '17 at 13:13
  • $\begingroup$ (cont) I'm struggling to understand how you're suggesting the network would learn to differentiate the two types of objects, without, as I thought you were originally saying, having two separate sets of inputs and nerves each capable of sensing one object type or the other. $\endgroup$ – J.Todd May 18 '17 at 13:13
  • 1
    $\begingroup$ It can only learn the difference if there is a difference in the input to the nerves. If the good circles are green and the bad circles are red and color vision is part of the input, that'll be enough. If the bad circles always move in groups and the good circles are always alone and it input vision is wide enough to see this difference, that would be enough too. This really has nothing to do with having one network or two. $\endgroup$ – BlindKungFuMaster May 18 '17 at 13:43
  • $\begingroup$ I was never suggesting two networks, I was talking about twice the inputs, one set connected to nerves which collide with good objects, one set which collide with bad. With what you just said "If the good circles are green and the bad circles are red and color vision is part of the input", you surely understand only values between a range of -1 to 1 can be input to each input neuron in a neural network, so how would that "color vision" (the thing Im trying to do basically) work fundamentally? How do you input that to the neural system? $\endgroup$ – J.Todd May 18 '17 at 14:03
  • 1
    $\begingroup$ @Viziionary: Color vision in a simulated environment can be based on RGB values of the pixels on screen, so every pixel gets three nerves. The full range of all nerves will be 2D, every single nerve will receive just one data point. If one set of nerves only touches bad objects and the other set of nerves only touches good objects, than you already have to know which objects are good and which are bad. Then most of what the NN should learn is already done. $\endgroup$ – BlindKungFuMaster May 25 '17 at 11:53

@BlindKungFuMaster answered my question in comments, but his answer doesn't reflect that information. If he changes his answer to contain the actual answer, I'll remove mine.

The answer to the question "How can object types be differentiated in the input of a neural network?" is:

Use different sensors (nerves) to detect different types of input.

So for example:

  • If you want the network to be capable of differentiating two different types of objects in a simple 2D environment, use two different sets of nerves, one to detect one object type, one to detect the other. So if you want to sense 10 points around your "organism", have 20 nerves, 10 neurons in your input layer dealing with one object type, 10 dealing with the other.

  • That's the most simple example, dealing with binary differences (object type 1 or object type 2), but it could be less binary, like this: Let's say there are three object types and think of each object types as 1/3 of a color value. So you have three sets of 10 nerves in total transmitting to your input layer (30 neurons) and each nerve set senses either R, G, or B. If you set up your system so that there are three "objects" to collide with, stacked on top of each other (like a single object), your neural network will be capable of handling objects differently based on their RGB color value, meaning it can now handle nearly infinite "types" of objects.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.