.. _example_plot_localization_tutorial.py: ===================================== Localizing an object in a large image ===================================== Convolutional neural networks can also be used to localize an object in a large image. This example will show the basic steps taken to find objects in images with convolutional neural networks, using the OverfeatTransformer and OverfeatLocalizer classes. Step 1: Input ============= The first image in the first row shows the image input to the OverfeatLocalizer. Step 2: Process windows over input ================================== The second image in the first row shows one processing window for the image. This box will be used as input to the OverfeatLocalizer, which internally gets processed and retrieves the top_n classes for that window out of 1000 possible classes. The last image in the first row shows *all* processing windows - each one of these windows has the entire convolutional neural network applied to it! Step 3: Identify matching points ================================ After processing the entire image, there are (n_X_windows, n_Y_windows, top_n) classification results. By finding only the points which match the desired class label, there is an approximate "detection region" for that object, formed by the matching points. These are plotted in the first image of the second row. Step 4: Draw bounding region ============================ There are a variety of ways to draw a bounding region given a set of points, but one of the simplest is to take the extreme values (in this case min and max for both X and y) and draw a box. This method is very susceptible to outliers and spurious classifications, but works fine for this example. Ultimately bounding regions are a form of density estimation, which means a wide variety of scikit-learn estimators can be used. Examples using scikit-learn's GMM class can be found in ``plot_multiple_localization``. .. image:: images/plot_localization_tutorial_001.png :align: center **Python source code:** :download:`plot_localization_tutorial.py ` .. literalinclude:: plot_localization_tutorial.py :lines: 48- **Total running time of the example:** 352.80 seconds ( 5 minutes 52.80 seconds)