RodTracker.backend.detection¶
TBD
- class Detector(cam_id: str, model: ScriptModule, images: List[Path], frames: List[int], classes: Dict[int, list], threshold: float = 0.5)[source]¶
Bases:
QRunnableObject for running the detection of rods in a thread different from the main thread.
This object runs the detection of rods in a set of frames for one camera angle. The desired colors to detect and their expected occurrences must be specified. Only predefined colors are supported at the moment.
- Parameters
cam_id (str) – ID of the camera on whos images the detection of rods shall be run.
model (ScriptModule) – Neural network model that shall be used for detection.
images (List[Path]) – Paths to the image files the detection of rods shall be performed on. Each entry in
imagescorresponds to one inframes.frames (List[int]) – Frames the detection of rods will be performed on. Each entry in
framescorresponds to one inimages.classes (Dict[int, list]) – Classes of objects to detect in the images, i.e. rod colors that shall be detected, togther with their human readable name and the amount of particles that shall be detected per frame individually for each class. list[0] : color as a
strlist[1] : expected amount of particles as anintthreshold (float, optional) –
Confidence threshold \(\in [0, 1]\) below which objects are rejected after detection.
Default is
0.5.
- Raises
ValueError – Is raised when
len(images) != len(frames).
See also
- cam_id¶
ID of the camera on whos images the detection of rods shall be run.
- Type
str
- frames¶
Frames the detection of rods will be performed on. Each entry in
framescorresponds to one inimages.- Type
List[int]
- images¶
Paths to the image files the detection of rods will be performed on. Each entry in
imagescorresponds to one inframes.- Type
List[Path]
- model¶
Neural network model that will be used for detection.
- Type
ScriptModule
- signals¶
Signals that can be emitted during the running of a
Detectorobject. Their purpose is to report errors, progress, and (intermediate) results.- Type
- threshold¶
Confidence threshold \(\in [0, 1]\) below which objects are rejected after detection.
\(\in [0, 1]\)
- Type
float
- expected¶
The amount of particles per frame for each class that shall be detected.
expected[class] = amount- Type
Dict[int, int]
- classes: Dict[int, str] = {}¶
Classes of objects to detect in the images, i.e. rod colors that will be detected.
Default is
{}.- Type
Dict[int, str]
- class DetectorSignals[source]¶
Bases:
QObjectHelper object to provide
Detectoraccess topyqtSignal.- error¶
Signal for propagating errors occuring in the
Worker’s thread.The transferred tuple should contain the following values:[0]: Exception type[1]: Exception value[2]: Exception traceback- Type
pyqtSignal(tuple)
- finished¶
Indicates the detection has finished successfully.
The payload is the ID of the camera dataset this detection process was run on.
- Type
pyqtSignal(str)
- progress¶
Reports the progress of started detections.
[0]: progress as the ratio of finished frames over all frames, so \(\in [0, 1]\)
[1]: DataFrame containing only the 2D data of the detected rods.
See also:
ParticleDetection.utils.datasets.add_points()[2]: ID of the camera dataset the frame is taken from.
- Type
pyqtSignal(float, DataFrame, str)
- class RodDetection(frame: int, cam_id: str, num_detected: int, *args, **kwargs)[source]¶
Bases:
ActionRepresentation of the detection of rods on one frame as a loggable action.
- Parameters
frame (int) – Frame the rods have been detected on.
cam_id (str) – ID of the camera the image was produced by.
num_detected (int) – Total number of rods that have been detected, i.e. all colors combined.
*args (Iterable) – Positional arguments after
textof theActionsuperclass.**kwargs (dict) – Keyword arguments of the
Actionsuperclass.
- num_detected¶
Total number of rods that have been detected, i.e. all colors combined.
- Type
int
- cam_id: str¶
ID of the camera the image was produced by.
- Type
str
- undo(_)[source]¶
- Raises
NotInvertableError – This action is generally not invertable.