Predictor that may be used for searching objects. More...
Inherits PredictorBase.
Public Member Functions | |
Tuple[cvb.polimago.SearchResult, int] | grid_search (self, cvb.Image img, cvb.Rect aoi, float grid_step, float threshold, float locality) |
Perform a grid search. More... | |
Tuple[bool, cvb.polimago.SearchResult, int, List[cvb.polimago.SearchResult]] | inspect (self, cvb.Image img, cvb.polimago.SearchResult res, int search_depth) |
Carries out the operation that grid_search executes for a grid point, starting at the perspective and position defined by the initial value of the parameter SearchResult. More... | |
cvb.Image | search_result_to_image (self, cvb.Image source_image, cvb.polimago.SearchResult res) |
Create a visual representation of a search result. More... | |
Public Member Functions inherited from PredictorBase | |
bool | is_compatible (self, cvb.Image img, cvb.Point2D pos) |
Verify the compatibility of a CVB image with this classifier. More... | |
Public Member Functions inherited from PolimagoFactoryCreatedObject | |
None | save (self, str file_name) |
Save this object into a file. More... | |
Properties | |
extraction_radius = property | |
float: The radius for extracting positive search instances. More... | |
feature_resolution_rest = property | |
int: The feature resolution to be used for the third and later classification steps. | |
feature_resolution_step_1_and_2 = property | |
int: The feature resolution to be used for the first two classification steps. | |
invariances = property | |
int: The invariances that have been trained on this classifier (see cvb.polimago.InvarianceType). | |
max_num_results = property | |
int: The maximum number of results that can be extracted in a GridSearch operation. More... | |
num_classification_steps = property | |
int: The number of classification steps defined during training. | |
rotation_range = property | |
cvb.AngleRange: The range of angles that was covered during classifier training. | |
sample_size = property | |
int: The sample size that has been used in each training set. | |
scale_range = property | |
cvb.NumberRange: The range of scale factors that was covered during classifier training. | |
Properties inherited from PolimagoFactoryCreatedObject | |
correction = property | |
cvb.Point2D: Correction factors in X and Y direction required to rescale the input images for projection onto the retina. | |
feature_window_extent = property | |
cvb.Rect: The feature window extent that has been used during classifier training. | |
file_name = property | |
str: Name of the file the object has been loaded from (or empty string if the object was not loaded). | |
image_planes = property | |
int: Intercept weight that has been used for generating this object. | |
interpolation = property | |
int: Interpolation setting used for generating this object (see cvb.polimago.InterpolationType). | |
lambda_ = property | |
float: Regularization value that has been used for generating this object. | |
offset = property | |
float: Intercept weight that has been used for generating this object. | |
preprocessing = property | |
str: Preprocessing code with which this object was generated. | |
retina_size = property | |
cvb.Size2D: Size of the 'Retina' in pixels. More... | |
Predictor that may be used for searching objects.
Load a saved Polimago search predictor from a file.
file_name : str Name of the file to be loaded.
Tuple[cvb.polimago.SearchResult, int] grid_search | ( | self, | |
cvb.Image | img, | ||
cvb.Rect | aoi, | ||
float | grid_step, | ||
float | threshold, | ||
float | locality | ||
) |
Perform a grid search.
If two results that exceed the quality requirement defined by the threshold parameter are spaced less than 'locality' pixels apart (in either x or y direction) then the result with the lower quality will be eliminated from the result list.
img : cvb.Image Image to search in.
aoi : cvb.Rect AOI inside the image to search in.
grid_step : float Spacing of the grid points in units of the feature window width/height.
threshold : float Minimum quality a result must have for being reported.
locality : float Minimum distance between the results that this SearchPredictor found.
Tuple[cvb.polimago.SearchResult, int] Tuple containing list of results that this SearchPredictor found in the area of interest and number of calls to the predictor's classification routine that have been carried out in the GridSearch call.
Tuple[bool, cvb.polimago.SearchResult, int, List[cvb.polimago.SearchResult]] inspect | ( | self, | |
cvb.Image | img, | ||
cvb.polimago.SearchResult | res, | ||
int | search_depth | ||
) |
Carries out the operation that grid_search executes for a grid point, starting at the perspective and position defined by the initial value of the parameter SearchResult.
When the function returns successfully, it will return SearchResult containing the final perspective and result quality. For additional information please see the tutorial on search functions of Polimago.
img : cvb.Image Image to work on.
res : cvb.polimago.SearchResult Search Result to start with.
search_depth : int Maximum number of steps to calculate (upon exit: number of steps actually calculated).
Tuple[bool, cvb.polimago.SearchResult, int, List[cvb.polimago.SearchResult]] Tuple containing success (if predictor found a result starting at the position defined through res parameter), final SearchResult, number of steps, and list of SearchResults leading from initial to final SearchResult value.
cvb.Image search_result_to_image | ( | self, | |
cvb.Image | source_image, | ||
cvb.polimago.SearchResult | res | ||
) |
Create a visual representation of a search result.
source_image : cvb.Image Image to create the representation from. This should be the image on which the result was found with this classifier.
res : cvb.polimago.SearchResult Search result (should match the image and this classifier).
cvb.Image Visual representation of the search result.
|
static |
float: The radius for extracting positive search instances.
The unit size is the size of the feature window, i.e. a value of 0.5 means that positive samples can be extracted from withing a range of +/- Feature Window Width and +/- Feature Window Height around each trained instance. Smaller values will necessitate a finer search grid but may yield better results on difficult search tasks.
|
static |
int: The maximum number of results that can be extracted in a GridSearch operation.
Increasing this value will increase the amount of memory allocated by this SearchPredictor object.