Package edu.tufts.hrilab.vision.stm
Class SimpleSearchManager
java.lang.Object
edu.tufts.hrilab.vision.stm.SearchManager
edu.tufts.hrilab.vision.stm.SimpleSearchManager
A SimpleSearchManager is capable of visually searching (detecting and
tracking) for a certain object type (e.g., face, coke can, etc.) or visual
region with certain properties (e.g., red, round, etc). A SimpleSearchManager
can have multiple means of detection and/or tracking but is guaranteed to
have at least one instantiated Detector. Using a Tracker is optional
depending on if this is a standalone search manager or part of a
CompositeSearchManager.
============ IMPORTANT ==================== (1) terminate() must be called
when a SearchManager is no longer used. (2) Every non-private class method
must be synchronized and call isValid() at the beginning of the method.
===========================================
-
Field Summary
Fields inherited from class edu.tufts.hrilab.vision.stm.SearchManager
analysisPolicy, defaultDetectorPredicate, description, incrementalDetector, incrementalImgProc, log, name, performanceInfo, serialProcessing, singleIteration, typeId, validFlag
-
Method Summary
Modifier and TypeMethodDescriptionboolean
addConstraint
(Term term, boolean incrementalImgProcFlag, boolean incrementalDetectorFlag, boolean singleIterationFlag, boolean serialProcessingFlag) Add ImageProcessor or Detector constraint.Get all of the VisionProcessers in the processing chain for this search.Get all available detector types, leaving out the current detector type.Get all available tracker types, leaving out the current tracker type.boolean
Get incremental processing flag for all image processors.getDetector
(NativeDetector.DetectorType detectorType) Get Detector option, if it exists.boolean
Get incremental processing flag for selected Detector.Get set of DetectorTypes available for this search.Get the first VisionProcess in the processing chain for this search.Get the last VisionProcess in the processing chain for this search.Get saliency operators as a ListModel to allow the UI to listen when changes to the operators are made.Find which available Detector is currently selected for use.Find which available Tracker is currently selected for use.boolean
boolean
getTracker
(NativeTracker.TrackerType trackerType) Get Tracker, if it exists.Get set of TrackerTypes available for this search.Get validator constraints as a ListModel to allow the UI to listen when changes to the constraints are made.boolean
Checks if at least one full detection -> tracking iteration has completed.boolean
Is this search currently running.Does the search meet the expectation of its set analysis policy.void
printStats
(String directory) Print the Detector and Tracker introspection statistics indirectory/detector_<id>.txt
anddirectory/tracker_<id>.txt
void
registerForNotification
(VisionProcess processor) This allows notifications to be sent between SearchManagers.boolean
removeConstraint
(Term term) Remove constraint from ImageProcessor or Detector.void
setConstraintsIncrementalProcessing
(boolean flag) Set the incremental processing flag for all image processors.boolean
setDetector
(NativeDetector.DetectorType detectorType) Switch the Detector to be used.void
setDetectorIncrementalProcessing
(boolean flag) Set the incremental processing flag for the Detector.void
setSerialProcessing
(boolean flag) void
setSingleIteration
(boolean flag) void
setTimeOfLastClientUse
(long time) Update introspection info: time of last client use.boolean
setTracker
(NativeTracker.TrackerType trackerType) Switch the Tracker to be used.protected final void
start()
Start type's detection, tracker, and constraints threads.protected final void
stop
(boolean wait) Stop constraints, detector, and tracker if they are running, and return immediately without waiting for processors to stop.void
unregisterForNotification
(VisionProcess processor) This allows notifications between SearchManagers to be canceled.Methods inherited from class edu.tufts.hrilab.vision.stm.SearchManager
addConstraint, addSearchManager, getDescriptors, getName, getRelatedTypeIds, getTypeId, hasStarted, isStartCaller, isValid, matchesDescriptors, setName, shouldBeRunning, start, stop, toString
-
Method Details
-
printStats
Print the Detector and Tracker introspection statistics indirectory/detector_<id>.txt
anddirectory/tracker_<id>.txt
- Parameters:
directory
-
-
addConstraint
public boolean addConstraint(Term term, boolean incrementalImgProcFlag, boolean incrementalDetectorFlag, boolean singleIterationFlag, boolean serialProcessingFlag) Add ImageProcessor or Detector constraint. This overloaded method should only be called from the GUI in order to maintain consistency across all uses from the Vision API.- Specified by:
addConstraint
in classSearchManager
incrementalImgProcFlag
- - if constraint is image processor, should run in incremental modeincrementalDetectorFlag
- - if constraint is detector, should run in incremental modesingleIterationFlag
- - if constraint should only run a single iterationserialProcessingFlag
- - if constraints should run in serial/parallel- Returns:
- boolean - if predicate mapped to a valid VisionProcessor
-
removeConstraint
Remove constraint from ImageProcessor or Detector. First tries to remove from ImageProcessor constraints, and if nothing was found matching the constraint, then tries to remove Detector (and replace with default Detector). NOTE: doesn't remove Detector yet!!- Specified by:
removeConstraint
in classSearchManager
- Parameters:
term
- to remove- Returns:
- True, if was successfully removed. If wasn't contained, returns false.
-
registerForNotification
Description copied from class:SearchManager
This allows notifications to be sent between SearchManagers. This SearchManager's Tracker will notify the passed in processor.- Specified by:
registerForNotification
in classSearchManager
- Parameters:
processor
- VisionProcess to be notified
-
unregisterForNotification
Description copied from class:SearchManager
This allows notifications between SearchManagers to be canceled.- Specified by:
unregisterForNotification
in classSearchManager
- Parameters:
processor
- VisionProcess to be notified
-
setDetectorIncrementalProcessing
public void setDetectorIncrementalProcessing(boolean flag) Set the incremental processing flag for the Detector.- Specified by:
setDetectorIncrementalProcessing
in classSearchManager
- Parameters:
flag
-
-
getDetectorIncrementalProcessing
public boolean getDetectorIncrementalProcessing()Get incremental processing flag for selected Detector. Returns "incrementalDetectorFlag" if no detector exists (as default preference to use incremental processing).- Specified by:
getDetectorIncrementalProcessing
in classSearchManager
- Returns:
-
setConstraintsIncrementalProcessing
public void setConstraintsIncrementalProcessing(boolean flag) Set the incremental processing flag for all image processors.- Specified by:
setConstraintsIncrementalProcessing
in classSearchManager
- Parameters:
flag
-
-
getConstraintsIncrementalProcessing
public boolean getConstraintsIncrementalProcessing()Get incremental processing flag for all image processors. Will print error if they are not consistent. Returns true if no image processors exist (as default preference to use incremental processing).- Specified by:
getConstraintsIncrementalProcessing
in classSearchManager
- Returns:
-
setSingleIteration
public void setSingleIteration(boolean flag) - Specified by:
setSingleIteration
in classSearchManager
-
getSingleIteration
public boolean getSingleIteration()- Specified by:
getSingleIteration
in classSearchManager
-
setSerialProcessing
public void setSerialProcessing(boolean flag) - Specified by:
setSerialProcessing
in classSearchManager
-
getSerialProcessing
public boolean getSerialProcessing()- Specified by:
getSerialProcessing
in classSearchManager
-
getSaliencyOperators
Get saliency operators as a ListModel to allow the UI to listen when changes to the operators are made.- Returns:
-
getValidatorConstraints
Get validator constraints as a ListModel to allow the UI to listen when changes to the constraints are made.- Returns:
-
getDetectorOptions
Get set of DetectorTypes available for this search. -
getTrackerOptions
Get set of TrackerTypes available for this search. -
getDetector
Get Detector option, if it exists.- Parameters:
detectorType
-- Returns:
- Detector, or null
-
getTracker
Get Tracker, if it exists.- Parameters:
trackerType
-- Returns:
- Tracker, or null
-
getSelectedDetector
Find which available Detector is currently selected for use.- Returns:
- Detector
-
getSelectedTracker
Find which available Tracker is currently selected for use.- Returns:
-
getFirstVisionProcessor
Description copied from class:SearchManager
Get the first VisionProcess in the processing chain for this search. This is usually a detector (but could conceivably be SaliencyOperators in the future).- Specified by:
getFirstVisionProcessor
in classSearchManager
- Returns:
-
getLastVisionProcessor
Description copied from class:SearchManager
Get the last VisionProcess in the processing chain for this search. This is usually the Tracker, but can be a Detector and Validator if there is no Tracker (as is the case with sub-SearchMangers in compositeSearchManagers).- Specified by:
getLastVisionProcessor
in classSearchManager
- Returns:
-
getAllVisionProcessors
Description copied from class:SearchManager
Get all of the VisionProcessers in the processing chain for this search. Currently used for the Vision Pipeline GUI- Specified by:
getAllVisionProcessors
in classSearchManager
-
setDetector
Switch the Detector to be used. If successful, also switches to a suitable Tracker.- Parameters:
detectorType
-- Returns:
- bool - if switch was successful
-
setTracker
Switch the Tracker to be used. If successful, also switches to a suitable Detector.- Parameters:
trackerType
-- Returns:
- bool - if switch was successful
-
meetsExpectations
Does the search meet the expectation of its set analysis policy. This is for vision introspection.- Specified by:
meetsExpectations
in classSearchManager
- Returns:
-
getAlternativeDetectorTypes
Get all available detector types, leaving out the current detector type.- Returns:
- set of DetectorTypes
-
getAlternativeTrackerTypes
Get all available tracker types, leaving out the current tracker type.- Returns:
- set of TrackerTypes
-
isRunning
public boolean isRunning()Is this search currently running.- Specified by:
isRunning
in classSearchManager
- Returns:
-
start
protected final void start()Start type's detection, tracker, and constraints threads.- Specified by:
start
in classSearchManager
-
stop
protected final void stop(boolean wait) Stop constraints, detector, and tracker if they are running, and return immediately without waiting for processors to stop.- Specified by:
stop
in classSearchManager
- Parameters:
wait
-
-
hasIterationCompleted
public boolean hasIterationCompleted()Description copied from class:SearchManager
Checks if at least one full detection -> tracking iteration has completed. This is required in order to get detection results.- Specified by:
hasIterationCompleted
in classSearchManager
- Returns:
-
setTimeOfLastClientUse
public void setTimeOfLastClientUse(long time) Description copied from class:SearchManager
Update introspection info: time of last client use.- Specified by:
setTimeOfLastClientUse
in classSearchManager
-