simet.pipeline.simple_pipeline¶
simet.pipeline.simple_pipeline ¶
SimplePipeline ¶
SimplePipeline(loader, metrics=None)
Minimal pipeline that loads two folders and computes selected metrics.
This pipeline wires a :class:DatasetLoader with two local providers
(parsed from filesystem paths) and computes one or more metrics. If no
metrics are specified, it defaults to running FID, RocAuc, and
PrecisionRecall in that order.
Expected YAML structure for :meth:from_yaml:
pipeline:
real_path: data/real_images
synth_path: data/synth_images
metrics: # optional; defaults to ["FID", "RocAuc", "PrecisionRecall"]
- FID
- RocAuc
- PrecisionRecall
Attributes:
| Name | Type | Description |
|---|---|---|
loader |
DatasetLoader
|
Loader built from the two provided paths. |
metrics |
list[Metric]
|
Metrics to compute; defaults to [FID, RocAuc, PrecisionRecall]. |
Example
sp = SimplePipeline.from_yaml(Path("simple.yaml")) sp.run() # computes each metric and logs the results
Initialize the simple pipeline.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
loader
|
DatasetLoader
|
Prepared dataset loader (constructed from two providers). |
required |
metrics
|
list[Metric] | None
|
Optional list of metric instances. If |
None
|
Source code in simet/pipeline/simple_pipeline.py
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | |
from_yaml
classmethod
¶
from_yaml(config_path)
Build a simple pipeline from a YAML file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config_path
|
Path
|
Path to a YAML file with the structure shown in the class docstring. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
SimplePipeline |
SimplePipeline
|
A pipeline instance ready to run. |
Raises:
| Type | Description |
|---|---|
OSError
|
If the file cannot be opened. |
YAMLError
|
If the YAML is invalid. |
ValueError
|
If required keys are missing (re-raised from |
Source code in simet/pipeline/simple_pipeline.py
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | |
run ¶
run()
Compute all configured metrics sequentially.
For each metric
1) Logs the metric name.
2) Calls metric.compute(self.loader).
3) Logs the computed result.
Returns:
| Type | Description |
|---|---|
None
|
None |
Source code in simet/pipeline/simple_pipeline.py
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | |