|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.hd.d.pg2k.ai.scorer.AbstractScorer
org.hd.d.pg2k.ai.scorer.AbstractImgScorer
public abstract class AbstractImgScorer
Base interface to compute the score and confidence for a 2D still image. All methods in this interface are guaranteed to be "safe" insofaras they will complete in "reasonable" time with reasonable heap memory (and other resource, eg stack) and without doing anything that wouldn't be allowed in a minimal Applet/JWS sandbox.
All classes implementing this interface should be completely thread-safe in their implementation of the computeScoreAndConfidence() method, and preferrably purely functional (no visible side-effects), with as many concurrent threads as required safely doing separate computations in any one instance.
Classes implementing this interface should, where possible, do their calculations using integer arithmetic, since FPUs to support float/double calaculations may be a scarce resource on newer highly-threaded CPUs such as Sun's Niagara.
TODO: At least tie the cache to the AEP/pipeline, not static.
| Field Summary | |
|---|---|
private static java.util.Map<java.lang.String,java.lang.ref.SoftReference<java.awt.image.BufferedImage>> |
_tnBICache
Private static cache from exhibit name to expanded (std) thumbnail image. |
| Fields inherited from class org.hd.d.pg2k.ai.scorer.AbstractScorer |
|---|
nameAndParameters, parameterNameRegex, parameterSepRegex, scorerNameRegex, SEPARATOR |
| Constructor Summary | |
|---|---|
AbstractImgScorer()
Create simple non-parameterised instance. |
|
AbstractImgScorer(java.lang.String nameAndParameters)
Create parameterised version. |
|
AbstractImgScorer(java.lang.String baseName,
java.util.List<ScorerParam> parameters)
Create parameterised version. |
|
| Method Summary | |
|---|---|
abstract ScoreAndConf |
computeScoreAndConfidence(java.awt.image.RenderedImage stillImage)
Compute score [-1,+1] and confidence[0,+1] for given image; never null. |
ScoreAndConf |
computeScoreAndConfidence(SimpleExhibitPipelineIF dataSource,
java.lang.String exhibitName)
Implement core/generic compute method specially for image types. |
| Methods inherited from class org.hd.d.pg2k.ai.scorer.AbstractScorer |
|---|
canonicalise, createPerturbedVariant, getBaseName, getDefaultName, getNameAndParameters, getParameterDefsAndValues, getPerturbedDefsAndValues, isValidParameterName, isValidScorerName, paramListAsMap, paramListAsString, parseNameAndParameters, similarNParams, verySimilar |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.hd.d.pg2k.ai.scorer.ScorerIF |
|---|
createPerturbedVariant, createVariant, createVariant, getBaseName, getNameAndParameters, getParameterDefsAndValues, getPerturbedDefsAndValues |
| Field Detail |
|---|
private static final java.util.Map<java.lang.String,java.lang.ref.SoftReference<java.awt.image.BufferedImage>> _tnBICache
The expanded images are held via SoftReferences to allow them to be ditched in case of memory shortage, and when individual thumbnails stop being used.
The cache key is the (full) exhibit name on the basis that thumbnails hardly ever change once created. This also means that we will stop hitting any thumbnail caches in the data pipeline once we have fetched a thumbnail once.
This cache is thread-safe and highly concurrent.
TODO: Deal with the case when a thumbnail IS changed/improved.
| Constructor Detail |
|---|
public AbstractImgScorer()
public AbstractImgScorer(java.lang.String nameAndParameters)
public AbstractImgScorer(java.lang.String baseName,
java.util.List<ScorerParam> parameters)
| Method Detail |
|---|
public abstract ScoreAndConf computeScoreAndConfidence(java.awt.image.RenderedImage stillImage)
stillImage - non-null still 2D image;
if greater than 256x256 pixels then will be internally scaled
public ScoreAndConf computeScoreAndConfidence(SimpleExhibitPipelineIF dataSource,
java.lang.String exhibitName)
throws java.io.IOException
We use the standard thumbnail as being representative of the full image (and usually good enough for a human to make a judgement from) with out requiring all the system resources of the full image.
For non-image types (or images with no thumbnails possible) this returns (0,0) to indicate that it does not have a view.
computeScoreAndConfidence in interface ScorerIFdataSource - souce of exhibit data and metadata; never nullexhibitName - name of exhibit; must be syntactically valid and not null
java.io.IOException - in case of I/O difficulties,
or when a thumbnail is not currently available but may be later (upon retry)
|
DHD Multimedia Gallery V1.50.55 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||