Module Expr Str Import alias identifier Import alias identifier ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias FunctionDef arguments args NameParam NameParam NameParam defaults body Assign NameStore AttributeLoad NameLoad attr Assign NameStore BinOpMult Num Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign NameStore SubscriptLoad NameLoad ExtSlice Slice Index Num Assign NameStore SubscriptLoad NameLoad ExtSlice Slice Index Num Assign NameStore TupleLoad BinOpSub SubscriptLoad NameLoad ExtSlice Slice Index Num BinOpFloorDiv NameLoad Num BinOpSub SubscriptLoad NameLoad ExtSlice Slice Index Num BinOpFloorDiv NameLoad Num Return Call NameLoad NameLoad NameLoad NameLoad keyword NameLoad keyword NameLoad keyword NameLoad decorator_list Assign NameStore Call NameLoad Str Assign NameStore Str Assign NameStore Str Assign NameStore Call NameLoad keyword Num keyword ListLoad NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore SubscriptLoad NameLoad Index Num Assign NameStore SubscriptLoad NameLoad Index Num Expr Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr keyword NameLoad Assign NameStore Call NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call NameLoad NameLoad Str Num Expr Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call NameLoad NameLoad Str Num Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad Call AttributeLoad NameLoad attr attr ListLoad Expr Call AttributeLoad Call AttributeLoad NameLoad attr attr ListLoad Expr Call AttributeLoad NameLoad attr
N/A N/A 
=======================================
Localizing multiple objects in an image
=======================================

Extending on the ``plot_localization_tutorial`` example, there are more advanced
ways to search for objects, and draw bounding boxes.

Rather than using the full class label, we can also use the wordnet hierarchy to
describe groups of labels which apply. In this case the high level labels
'cat' and 'dog' are used to search through the image. By specifying 'cat.n.01',
the OverfeatLocalizer will use class tags which fall into the group of
'cat.n.01' based on the WordNet hierarchy. Dogs work the same same way, using
'dog.n.01'.

By allowing specification of higher level groupings, it is easier
to search for a variety of subjects, but may lead to confusion when drawing
bounding boxes if the subjects both fall under the same WordNet group, but are
not the same class. Imagine an image of two different species cats -
in this case the exact class labels may be better at creating bounding boxes.

It is also beneficial to use scikit-learn's Gaussian Mixture Models to
better estimate bounding boxes without the influence of outliers. In this case,
one Gaussian will be placed to try and describe all of the matched points. Using
a width and height bound of 3 standard deviations, it is possible to draw
bounding boxes which are more robust to spurious points than the simple
method used in ``plot_single_localization``.

 N/A numpy np N/A matplotlib.pyplot plt matplotlib.patches Rectangle sklearn_theano.datasets load_sample_image sklearn_theano.feature_extraction OverfeatLocalizer sklearn.mixture GMM convert_gmm_to_box N/A N/A gmm color alpha N/A N/A N/A midpoint N/A gmm means_ N/A std N/A 3 N/A N/A np sqrt N/A clf covars_ N/A width N/A std N/A N/A N/A 0 N/A height N/A std N/A N/A N/A 1 N/A upper_left_point N/A N/A N/A midpoint N/A N/A N/A 0 N/A width 2 N/A N/A midpoint N/A N/A N/A 1 N/A height 2 N/A N/A Rectangle upper_left_point width height ec color fc color alpha alpha N/A N/A X N/A load_sample_image cat_and_dog.jpg N/A dog_label dog.n.01 N/A cat_label cat.n.01 N/A clf N/A OverfeatLocalizer top_n 1 match_strings N/A dog_label cat_label N/A points N/A N/A clf predict X N/A dog_points N/A points N/A 0 N/A cat_points N/A points N/A 1 N/A N/A N/A plt imshow X N/A ax N/A N/A plt gca N/A N/A N/A ax autoscale enable False N/A clf N/A GMM N/A N/A N/A clf fit dog_points N/A dog_box N/A convert_gmm_to_box clf darkred 0.6 N/A N/A N/A clf fit cat_points N/A cat_box N/A convert_gmm_to_box clf steelblue 0.6 N/A N/A N/A ax add_patch dog_box N/A N/A N/A ax add_patch cat_box N/A N/A N/A N/A N/A ax get_xaxis set_ticks N/A N/A N/A N/A N/A N/A ax get_yaxis set_ticks N/A N/A N/A N/A plt show