Package edu.tufts.hrilab.vision.stm
Class SearchManager
java.lang.Object
edu.tufts.hrilab.vision.stm.SearchManager
- Direct Known Subclasses:
CompositeSearchManager,RelationSearchManager,SimpleSearchManager
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected TaskAnalysisPolicyprotected Termprotected booleanprotected booleanprotected org.slf4j.Loggerprotected Termprotected TaskPerformanceInformationprotected booleanprotected booleanprotected final longprotected boolean -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanaddConstraint(Term term) Add ImageProcessor or Detector constraint.abstract booleanaddConstraint(Term term, boolean incrementalImgProcFlag, boolean incrementalDetectorFlag, boolean singleIterationFlag, boolean serialProcessingFlag) Add ImageProcessor or Detector constraint.voidaddSearchManager(List<Variable> variables, SearchManager searchManager) Add a sub-SearchManager to this SearchManager.abstract Set<VisionProcess>Get all of the VisionProcessers in the processing chain for this search.abstract booleanGet incremental processing flag for all image processors.Get predicates of search type.abstract booleanGet incremental processing flag for selected Detectors.abstract VisionProcessGet the first VisionProcess in the processing chain for this search.abstract VisionProcessGet the last VisionProcess in the processing chain for this search.final TermgetName()Get name of SearchManager.Get a list of SearchManager IDs This is especially important for searches that contain sub-searches like relationabstract booleanabstract booleanfinal longGet unique SearchManager ID (search typeId).abstract booleanChecks if at least one full detection -> tracking iteration has completed.final booleanhasStarted(Object caller) Check if this SearchManager has been started by the caller.abstract booleanIs this search currently running.booleanisStartCaller(Object caller) Check if caller has called start on this VisionProcessor.protected voidisValid()final booleanmatchesDescriptors(List<? extends Term> descriptors) Returns true if predicates exactly* match SearchManager's description.abstract Collection<TaskAnalysisPolicy.Result>Does the search meet the expectation of its set analysis policy.abstract voidregisterForNotification(VisionProcess processor) This allows notifications to be sent between SearchManagers.abstract booleanremoveConstraint(Term term) Remove constraint from ImageProcessor or Detector.abstract voidsetConstraintsIncrementalProcessing(boolean flag) Set the incremental processing flag for all image processors.abstract voidsetDetectorIncrementalProcessing(boolean flag) Set the incremental processing flag for the Detectors.final voidSet name of SearchManager.abstract voidsetSerialProcessing(boolean flag) abstract voidsetSingleIteration(boolean flag) abstract voidsetTimeOfLastClientUse(long time) Update introspection info: time of last client use.final booleanprotected abstract voidstart()final voidStart detector(s), tracker(s), and constraint(s) threads of everything associated with this search.protected abstract voidstop(boolean wait) final voidStop detector(s), tracker(s), and constraint(s) of everything associated with this search if they are running.final StringtoString()Not synchronized because the GUI frequently calls this method for repainting so calling invokeAndWait (which needs to happen occasionally) will cause a deadlock.abstract voidunregisterForNotification(VisionProcess processor) This allows notifications between SearchManagers to be canceled.
-
Field Details
-
typeId
protected final long typeId -
name
-
description
-
performanceInfo
-
analysisPolicy
-
validFlag
protected boolean validFlag -
defaultDetectorPredicate
-
incrementalImgProc
protected boolean incrementalImgProc -
incrementalDetector
protected boolean incrementalDetector -
serialProcessing
protected boolean serialProcessing -
singleIteration
protected boolean singleIteration -
log
protected org.slf4j.Logger log
-
-
Method Details
-
toString
Not synchronized because the GUI frequently calls this method for repainting so calling invokeAndWait (which needs to happen occasionally) will cause a deadlock. -
setName
Set name of SearchManager. a SearchManager is not required to have a name.- Parameters:
typeName-
-
getName
Get name of SearchManager. This is null if not explicitly set by the setName method.- Returns:
-
getDescriptors
Get predicates of search type. (e.g., color(X,white), type(X,box), color(Y,red), type(Y,cross), on(Y,X))- Returns:
-
getTypeId
public final long getTypeId()Get unique SearchManager ID (search typeId).- Returns:
-
getRelatedTypeIds
Get a list of SearchManager IDs This is especially important for searches that contain sub-searches like relation- Returns:
-
matchesDescriptors
Returns true if predicates exactly* match SearchManager's description. (*) Currently adds a default detector if a detector is not specified in the descriptors, and removes any descriptors that don't map to any detectors or image processors.- Parameters:
descriptors-- Returns:
-
addSearchManager
Add a sub-SearchManager to this SearchManager. This is only valid for SearchManagers that are composed of other SearchManagers.- Parameters:
variables-searchManager-
-
addConstraint
Add ImageProcessor or Detector constraint. Uses the flags set at runtime: startFlag, incrementalFlag, and singleIteration.- Parameters:
term-- Returns:
- bool - if predicate mapped to an ImageProcessor or Detector
-
addConstraint
public abstract 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.- Parameters:
term-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!!- Parameters:
term- to remove- Returns:
- True, if was successfully removed. If wasn't contained, returns false.
-
registerForNotification
This allows notifications to be sent between SearchManagers. This SearchManager's Tracker will notify the passed in processor.- Parameters:
processor- VisionProcess to be notified
-
unregisterForNotification
This allows notifications between SearchManagers to be canceled.- Parameters:
processor- VisionProcess to be notified
-
getFirstVisionProcessor
Get the first VisionProcess in the processing chain for this search. This is usually a detector (but could conceivably be SaliencyOperators in the future).- Returns:
-
getLastVisionProcessor
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).- Returns:
-
getAllVisionProcessors
Get all of the VisionProcessers in the processing chain for this search. Currently used for the Vision Pipeline GUI -
isRunning
public abstract boolean isRunning()Is this search currently running.- Returns:
-
isStartCaller
Check if caller has called start on this VisionProcessor.- Returns:
-
start
Start detector(s), tracker(s), and constraint(s) threads of everything associated with this search.- Parameters:
caller-
-
stop
Stop detector(s), tracker(s), and constraint(s) of everything associated with this search if they are running.- Parameters:
caller-wait- if should wait for everything to stop before returning
-
hasStarted
Check if this SearchManager has been started by the caller.- Parameters:
caller-- Returns:
-
start
protected abstract void start() -
stop
protected abstract void stop(boolean wait) -
shouldBeRunning
public final boolean shouldBeRunning() -
hasIterationCompleted
public abstract boolean hasIterationCompleted()Checks if at least one full detection -> tracking iteration has completed. This is required in order to get detection results.- Returns:
-
setDetectorIncrementalProcessing
public abstract void setDetectorIncrementalProcessing(boolean flag) Set the incremental processing flag for the Detectors.- Parameters:
flag-
-
getDetectorIncrementalProcessing
public abstract boolean getDetectorIncrementalProcessing()Get incremental processing flag for selected Detectors. Returns "incrementalDetectorFlag" if no detector exists (as default preference to use incremental processing).- Returns:
-
setConstraintsIncrementalProcessing
public abstract void setConstraintsIncrementalProcessing(boolean flag) Set the incremental processing flag for all image processors.- Parameters:
flag-
-
getConstraintsIncrementalProcessing
public abstract 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).- Returns:
-
setSingleIteration
public abstract void setSingleIteration(boolean flag) -
getSingleIteration
public abstract boolean getSingleIteration() -
setSerialProcessing
public abstract void setSerialProcessing(boolean flag) -
getSerialProcessing
public abstract boolean getSerialProcessing() -
setTimeOfLastClientUse
public abstract void setTimeOfLastClientUse(long time) Update introspection info: time of last client use.- Parameters:
time-
-
meetsExpectations
Does the search meet the expectation of its set analysis policy. This is for vision introspection.- Returns:
-
isValid
protected void isValid()
-