Base Metric
Base metric class for image generation evaluation.
BaseMetric
¶
Bases: ABC
Abstract base class for all evaluation metrics.
All metrics must inherit from this class and implement the required methods.
Attributes:
| Name | Type | Description |
|---|---|---|
model |
The generative model being evaluated. |
Source code in image_gen\metrics\base.py
is_lower_better
abstractmethod
property
¶
Indicates whether a lower metric value is better.
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if lower values indicate better performance, False otherwise. |
name
abstractmethod
property
¶
Get the name of the metric.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The name of the metric. |
__call__(real, generated, *args, **kwargs)
abstractmethod
¶
Compute the metric value between real and generated samples.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
real
|
Tensor
|
Tensor containing real samples. |
required |
generated
|
Tensor
|
Tensor containing generated samples. |
required |
*args
|
Any
|
Additional positional arguments. |
()
|
**kwargs
|
Any
|
Additional keyword arguments. |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
The computed metric value. |
Source code in image_gen\metrics\base.py
__init__(model)
¶
Initialize the metric with a generative model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
GenerativeModel
|
The generative model to be evaluated with this metric. |
required |
__str__()
¶
Get a string representation of the metric.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
String representation including class name and parameters. |
Source code in image_gen\metrics\base.py
config()
¶
Get the configuration parameters for this metric.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
Dictionary containing configuration parameters. |