Skip to content

Commit 9d09fd0

Browse files
authored
Fix RCV2 mean and scale values (#59)
1 parent acb3c19 commit 9d09fd0

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

modelconverter/packages/rvc2/exporter.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -120,15 +120,15 @@ def _export_openvino_ir(self) -> Path:
120120
scale_values_str = ""
121121
for name, inp in self.inputs.items():
122122
# Append mean values in a similar style
123-
if inp.mean_values is not None:
123+
if inp.is_color_input and inp.mean_values is not None:
124124
if mean_values_str:
125125
mean_values_str += ","
126126
mean_values_str += (
127127
f"{name}[{', '.join(str(v) for v in inp.mean_values)}]"
128128
)
129129

130130
# Append scale values in a similar style
131-
if inp.scale_values is not None:
131+
if inp.is_color_input and inp.scale_values is not None:
132132
if scale_values_str:
133133
scale_values_str += ","
134134
scale_values_str += (

modelconverter/utils/config.py

+4
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,10 @@ class InputConfig(OutputConfig):
141141
def encoding_mismatch(self) -> bool:
142142
return self.encoding.from_ != self.encoding.to
143143

144+
@property
145+
def is_color_input(self) -> bool:
146+
return self.encoding.from_ in {Encoding.RGB, Encoding.BGR}
147+
144148
@model_validator(mode="after")
145149
def _validate_grayscale_inputs(self) -> Self:
146150
if self.layout is None:

0 commit comments

Comments
 (0)