Package qupath.opencv.dnn
Class DnnObjectClassifier
java.lang.Object
qupath.lib.classifiers.object.AbstractObjectClassifier<BufferedImage>
qupath.opencv.dnn.DnnObjectClassifier
- All Implemented Interfaces:
qupath.lib.classifiers.object.ObjectClassifier<BufferedImage>,qupath.lib.io.UriResource
public class DnnObjectClassifier
extends qupath.lib.classifiers.object.AbstractObjectClassifier<BufferedImage>
implements qupath.lib.io.UriResource
Initial implementation of a patch-based
ObjectClassifier using an OpenCV-compatible DNN.
Warning! This implementation is likely to change in the future.
-
Field Summary
Fields inherited from interface qupath.lib.classifiers.object.ObjectClassifier
PROJECT_LOCATION -
Constructor Summary
ConstructorsConstructorDescriptionDnnObjectClassifier(qupath.lib.objects.PathObjectFilter filter, DnnModel model, List<qupath.lib.objects.classes.PathClass> pathClasses, int width, int height, double requestedPixelSize) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionintclassifyObjects(qupath.lib.images.ImageData<BufferedImage> imageData, Collection<? extends qupath.lib.objects.PathObject> pathObjects, boolean resetExistingClass) getMissingFeatures(qupath.lib.images.ImageData<BufferedImage> imageData, Collection<? extends qupath.lib.objects.PathObject> pathObjects) Collection<qupath.lib.objects.classes.PathClass> getURIs()protected inttryToClassify(List<? extends qupath.lib.objects.PathObject> pathObjects, qupath.lib.images.servers.ImageServer<BufferedImage> server, double downsample, IntFunction<qupath.lib.objects.classes.PathClass> classifier) Try to classify a batch of objects.protected booleantryToClassify(qupath.lib.objects.PathObject pathObject, qupath.lib.images.servers.ImageServer<BufferedImage> server, double downsample, IntFunction<qupath.lib.objects.classes.PathClass> classifier) booleanupdateURIs(Map<URI, URI> replacements) Methods inherited from class qupath.lib.classifiers.object.AbstractObjectClassifier
classifyObjects, getCompatibleObjectsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface qupath.lib.io.UriResource
getUris, updateUris
-
Constructor Details
-
DnnObjectClassifier
public DnnObjectClassifier(qupath.lib.objects.PathObjectFilter filter, DnnModel model, List<qupath.lib.objects.classes.PathClass> pathClasses, int width, int height, double requestedPixelSize) Constructor.- Parameters:
filter- filter to select compatible optionsmodel- wrapper for the DNN model, including optional preprocessingpathClasses- ordered list of classifications, corresponding to the predicted labelswidth- patch width, in pixels, at the classification sizeheight- patch height, in pixels, at the classification siderequestedPixelSize- requested pixel size, in calibrated units, used to calculate the downsample value
-
-
Method Details
-
getPathClasses
- Specified by:
getPathClassesin interfacequpath.lib.classifiers.object.ObjectClassifier<BufferedImage>
-
classifyObjects
public int classifyObjects(qupath.lib.images.ImageData<BufferedImage> imageData, Collection<? extends qupath.lib.objects.PathObject> pathObjects, boolean resetExistingClass) - Specified by:
classifyObjectsin interfacequpath.lib.classifiers.object.ObjectClassifier<BufferedImage>
-
tryToClassify
protected boolean tryToClassify(qupath.lib.objects.PathObject pathObject, qupath.lib.images.servers.ImageServer<BufferedImage> server, double downsample, IntFunction<qupath.lib.objects.classes.PathClass> classifier) -
tryToClassify
protected int tryToClassify(List<? extends qupath.lib.objects.PathObject> pathObjects, qupath.lib.images.servers.ImageServer<BufferedImage> server, double downsample, IntFunction<qupath.lib.objects.classes.PathClass> classifier) Try to classify a batch of objects.- Parameters:
pathObjects-server-downsample-classifier-- Returns:
- number of classified objects
-
getMissingFeatures
public Map<String,Integer> getMissingFeatures(qupath.lib.images.ImageData<BufferedImage> imageData, Collection<? extends qupath.lib.objects.PathObject> pathObjects) - Specified by:
getMissingFeaturesin interfacequpath.lib.classifiers.object.ObjectClassifier<BufferedImage>
-
getURIs
- Specified by:
getURIsin interfacequpath.lib.io.UriResource- Throws:
IOException
-
updateURIs
- Specified by:
updateURIsin interfacequpath.lib.io.UriResource- Throws:
IOException
-