Answers.Body: <p>Here is some general info on how NNs work in relation to this specific problem. Hopefully it will provide some insight:</p>
  
  <p>To identify target object, you can just train an NN to perform classification of images. Now, you will run into potential problems where this image can be located anywhere in given frame of input from the camera.</p>
  
  <p>Let's say; you train a human NN that's able to act on 60px x 120px (so you will have 10800 input in your NN for the input layer). Under the assumption you can train the NN to identify whether or not the target object is showing in the image provided, you can use this trained NN to locate the object on the input frame.</p>
  
  <p>Let's say the input frame from the camera is 640px x 480px. You will run into several potential problems
  1) The object that's closer to the camera will be larger while the object that's further away from the camera will be smaller
  2) The object may be located anywhere in the frame.</p>
  
  <p>To overcome this problem with your already trained NN, I would start with a different mask size, for example, the first one I will probably have my first mask convolute all pixels with 240px x 480px. The first step is, scale it to 60px x 120px (which you can tell it is pretty much 4x) and capture the subset of pixels from pixels located in the area of (0,0) and (240, 480) and run it through the NN, If it yields true, then I will typically draw a box around the region to indicate the target object has been found.</p>
  
  <p>Next, you shift over to 1-3 pixel and rerun it. For example, if we choose to move by 3px, then the region we are testing will be (3, 0) and (243, 480).</p>
  
  <p>Once you finish this scale, you will want to choose a smaller mask, maybe something like 200px x 400px and do the same thing. When finished, go even smaller until you believe there's no point to search for an even smaller region because it is not going to be sufficient resolution for NN.</p>
  
  <p>That's just my thought; maybe there's an even more efficient algorithm. Ultimately, I am sure there's a lot more can be optimized than what I've mentioned above!</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-12-13T19:31:44.737Z
Answers.Text: Your approach looks good, but can you tell me an approximated hardware, not the required for training but the required for "run" the NN in real time. Could you also tell me if the process can be simplified using TensorFlow?
Answers.UserDisplayName: ppdmartell
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-12-14T03:11:19.660Z
Answers.Text: It depends on your input layer. I believe forward-prop isn't too heavy to perform. What's really heavy is the back-prop. It will definitely help if you have a NVidia GPU which does matrix-multiplication fast. I say for "non-mission-critical", if you exam 2-3 frames per seconds, a regular CUDA support graphic card will be enough for forward-prop.
Answers.UserDisplayName: WorldWind
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-12-14T03:25:48.043Z
Answers.Text: (continue)
  Just to put runtime in perspective (please correct me if I am wrong), depending on the number of layers you have, since the separation of concave regions may exist if it is greater than or equal to 3 layers, we can assume 3 layers for the sake of simplifying the calculation.
Answers.UserDisplayName: WorldWind
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-12-14T03:26:03.557Z
Answers.Text: (continue)
  We can also assume that each neuron is a pretty simple function (i.e. sigmoid function), that can be considered as constant O(K) and given that for each step we have n neurons O(n), we can roughly estimate the running time is O(n^2 + K) for this forward prop to run. Therefore, based on the big O rules, we pretty much can assume it is O(n^2).
Answers.UserDisplayName: WorldWind
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-12-14T03:27:12.770Z
Answers.Text: So, consider you do it in GPU that it runs matrix multiplication in parallel, it is going to be relatively fast! In theory, your CPU shouldn't even spike much because we don't use CPU to process calculation.
Answers.UserDisplayName: WorldWind
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-12-14T12:04:34.110Z
Answers.Text: I'm taking your answer as the answer because my question was theoretical and you knew how to clear some doubts I had.
Answers.UserDisplayName: ppdmartell
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-12-10T06:05:09.963Z
Answers.LastActivityDate: 2017-12-10T21:04:32.487Z
Answers.LastEditDate: 2017-12-10T21:04:32.487Z
Answers.UserDisplayName: WorldWind
Body: <p>I was thinking, what if we could combine Artificial Intelligence (Neural network for image recognition), computer hardware and a security camera for identify any breaking into our backyard at 12:00am - 8:00am? Of course my current knowledge leads me to only a simple question. So, in order to have a general idea:</p>
  
  <ul>
  <li>¿Have been this already solved using a commercial or free software?</li>
  <li>¿Can this be done using TensorFlow?</li>
  <li>¿Is there any free set of images with millions of them to teach any AI distinguish between a man and another moving object?</li>
  <li>¿Approximate hardware requirements for doing this?</li>
  </ul>
  
  <p>If this question could be silly please mark it as off-topic. I based this idea on autonomous driving car, they can both recognize images and drive at the same time. Unless they have within a super computer I guess maybe the previous idea can be fulfill.</p>
  
  <p>Update 1: I found this <a href="https://ai.stackexchange.com/questions/1453/can-convnets-be-used-for-real-time-object-recognition-from-video-feed">Can ConvNets be used for real-time object recognition from video feed?</a> but I guess it could be outdated. Right now I'm in the land of "maybe" (lack of knowledge).</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-12-07T18:36:49.147Z
Comments.Text: Welcome to AI!  From what I've been gleaning off of the DL folks, while you might need robust computing to train the algorithm, once it is trained, it would be able to run on a much less robust system.   I'd think the real problem with training in this regard would be the dataset.  I'm guessing frequency of break-in attempts is fairly low, and these types of systems need a huge sample.
Comments.UserDisplayName: DukeZhou
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-12-07T18:49:23.817Z
Comments.Text: So basically the problem lays in a large images dataset (specific for recognizing human shapes) and a powerful hardware to train the neural network.
Comments.UserDisplayName: ppdmartell
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-12-07T19:52:50.373Z
Comments.Text: in term of data sample problems, I was more meaning images/videos of actual break-in and trespassing attempts vs. lawful presence on the property (by the owners, neighbors, friends, etc., even the kids sneaking out at night;)  Lawful presence would be easy, but break-ins are probably statistically rare, even in high-crime areas. So getting a sufficient sample size of break-in attempts sufficient to train a Deep Learning system would probably require a monumental, coordinated effort.
Comments.UserDisplayName: DukeZhou
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-12-07T19:57:57.577Z
Comments.Text: By contrast, simply recognizing a human being, their status & intentions irrelevant, would probably be doable.  So if you're just looking for a system that tells you there is a person in the yard, that's significantly less difficult.
Comments.UserDisplayName: DukeZhou
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-12-07T20:17:53.133Z
Comments.Text: Sorry, I should have started with that. I was thinking about night, probably 3:00 am and with no kids playing around XD. The only presence of a human being in your backyard at 3:00 am it's at least an emergency. Changing the conditions then what do I need now? Of course, if the AI gets a picture (frame) and recognize a human shape the problem then is solved. I guess there is no need for learning about videos of breaking in cases.
Comments.UserDisplayName: ppdmartell
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-12-07T20:22:09.787Z
Comments.Text: In terms of applied ML, that's currently outside my skill set. (I try to keep up on what's going on in the field, but my own AI endeavors are in different areas.)  But I'm pretty sure human-shape recognition is an area of great focus in the field. Autonomous vehicles, for instance, ideally need to make this distinction.
Comments.UserDisplayName: DukeZhou
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-12-08T05:21:25.617Z
Comments.Text: but, would you really need this approach to solve your problem?
Comments.UserDisplayName: k.c. sayz 'k.c sayz'
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-12-13T19:26:36.347Z
Comments.Text: @k.c.sayz'k.csayz' An Artificial Intelligence approach do you mean?
Comments.UserDisplayName: ppdmartell
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-12-13T19:52:59.523Z
Comments.Text: @Ophion as in, depending on your use case / data source / real world concerns, you could pursuit simpler methods.
Comments.UserDisplayName: k.c. sayz 'k.c sayz'
Tags: <neural-networks><image-recognition>
Title: Real time image processing for object recognition using security cameras
UserDisplayName: ppdmartell
ThreadText: # Real time image processing for object recognition using security cameras
  
  (Asked by: username_0 on 2017-12-07)
  
  I was thinking, what if we could combine Artificial Intelligence (Neural network for image recognition), computer hardware and a security camera for identify any breaking into our backyard at 12:00am - 8:00am? Of course my current knowledge leads me to only a simple question. So, in order to have a general idea:
  
  * ¿Have been this already solved using a commercial or free software?
  * ¿Can this be done using TensorFlow?
  * ¿Is there any free set of images with millions of them to teach any AI distinguish between a man and another moving object?
  * ¿Approximate hardware requirements for doing this?
  
  If this question could be silly please mark it as off-topic. I based this idea on autonomous driving car, they can both recognize images and drive at the same time. Unless they have within a super computer I guess maybe the previous idea can be fulfill.
  
  Update 1: I found this [Can ConvNets be used for real-time object recognition from video feed?](https://ai.stackexchange.com/questions/1453/can-convnets-be-used-for-real-time-object-recognition-from-video-feed) but I guess it could be outdated. Right now I'm in the land of "maybe" (lack of knowledge).
  
  **Tags:** neural-networks, image-recognition
  
  > **Comments:**
  > **username_1**: Welcome to AI!  From what I've been gleaning off of the DL folks, while you might need robust computing to train the algorithm, once it is trained, it would be able to run on a much less robust system.   I'd think the real problem with training in this regard would be the dataset.  I'm guessing frequency of break-in attempts is fairly low, and these types of systems need a huge sample.  
  > **username_0**: So basically the problem lays in a large images dataset (specific for recognizing human shapes) and a powerful hardware to train the neural network.  
  > **username_1**: in term of data sample problems, I was more meaning images/videos of actual break-in and trespassing attempts vs. lawful presence on the property (by the owners, neighbors, friends, etc., even the kids sneaking out at night;)  Lawful presence would be easy, but break-ins are probably statistically rare, even in high-crime areas. So getting a sufficient sample size of break-in attempts sufficient to train a Deep Learning system would probably require a monumental, coordinated effort.  
  > **username_1**: By contrast, simply recognizing a human being, their status & intentions irrelevant, would probably be doable.  So if you're just looking for a system that tells you there is a person in the yard, that's significantly less difficult.  
  > **username_0**: Sorry, I should have started with that. I was thinking about night, probably 3:00 am and with no kids playing around XD. The only presence of a human being in your backyard at 3:00 am it's at least an emergency. Changing the conditions then what do I need now? Of course, if the AI gets a picture (frame) and recognize a human shape the problem then is solved. I guess there is no need for learning about videos of breaking in cases.  
  > **username_1**: In terms of applied ML, that's currently outside my skill set. (I try to keep up on what's going on in the field, but my own AI endeavors are in different areas.)  But I'm pretty sure human-shape recognition is an area of great focus in the field. Autonomous vehicles, for instance, ideally need to make this distinction.  
  > **username_2**: but, would you really need this approach to solve your problem?  
  > **username_0**: @username_2sayz'k.csayz' An Artificial Intelligence approach do you mean?  
  > **username_2**: @Ophion as in, depending on your use case / data source / real world concerns, you could pursuit simpler methods.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_3 on 2017-12-10. Score: 2 | Accepted answer
  
  Here is some general info on how NNs work in relation to this specific problem. Hopefully it will provide some insight:
  
  To identify target object, you can just train an NN to perform classification of images. Now, you will run into potential problems where this image can be located anywhere in given frame of input from the camera.
  
  Let's say; you train a human NN that's able to act on 60px x 120px (so you will have 10800 input in your NN for the input layer). Under the assumption you can train the NN to identify whether or not the target object is showing in the image provided, you can use this trained NN to locate the object on the input frame.
  
  Let's say the input frame from the camera is 640px x 480px. You will run into several potential problems
  1) The object that's closer to the camera will be larger while the object that's further away from the camera will be smaller
  2) The object may be located anywhere in the frame.
  
  To overcome this problem with your already trained NN, I would start with a different mask size, for example, the first one I will probably have my first mask convolute all pixels with 240px x 480px. The first step is, scale it to 60px x 120px (which you can tell it is pretty much 4x) and capture the subset of pixels from pixels located in the area of (0,0) and (240, 480) and run it through the NN, If it yields true, then I will typically draw a box around the region to indicate the target object has been found.
  
  Next, you shift over to 1-3 pixel and rerun it. For example, if we choose to move by 3px, then the region we are testing will be (3, 0) and (243, 480).
  
  Once you finish this scale, you will want to choose a smaller mask, maybe something like 200px x 400px and do the same thing. When finished, go even smaller until you believe there's no point to search for an even smaller region because it is not going to be sufficient resolution for NN.
  
  That's just my thought; maybe there's an even more efficient algorithm. Ultimately, I am sure there's a lot more can be optimized than what I've mentioned above!
  
  > **Comments:**
  > **username_0**: Your approach looks good, but can you tell me an approximated hardware, not the required for training but the required for "run" the NN in real time. Could you also tell me if the process can be simplified using TensorFlow?  
  > **username_3**: It depends on your input layer. I believe forward-prop isn't too heavy to perform. What's really heavy is the back-prop. It will definitely help if you have a NVidia GPU which does matrix-multiplication fast. I say for "non-mission-critical", if you exam 2-3 frames per seconds, a regular CUDA support graphic card will be enough for forward-prop.  
  > **username_3**: (continue) Just to put runtime in perspective (please correct me if I am wrong), depending on the number of layers you have, since the separation of concave regions may exist if it is greater than or equal to 3 layers, we can assume 3 layers for the sake of simplifying the calculation.  
  > **username_3**: (continue) We can also assume that each neuron is a pretty simple function (i.e. sigmoid function), that can be considered as constant O(K) and given that for each step we have n neurons O(n), we can roughly estimate the running time is O(n^2 + K) for this forward prop to run. Therefore, based on the big O rules, we pretty much can assume it is O(n^2).  
  > **username_3**: So, consider you do it in GPU that it runs matrix multiplication in parallel, it is going to be relatively fast! In theory, your CPU shouldn't even spike much because we don't use CPU to process calculation.  
  > **username_0**: I'm taking your answer as the answer because my question was theoretical and you knew how to clear some doubts I had.  
  
  ---
  
  