Skip to content

Commit

Permalink
fix logic on the creation of final NN Archive regarding the reverse_c…
Browse files Browse the repository at this point in the history
…hannels flag
  • Loading branch information
ptoupas committed Nov 8, 2024
1 parent 4d99f9d commit 230b1ff
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions modelconverter/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ def extract_preprocessing(
encoding = inp.encoding
layout = inp.layout

dai_type = encoding.from_.value
dai_type = encoding.to.value
if dai_type != "NONE":
if inp.data_type == DataType.FLOAT16:
type = "F16F16F16"
Expand All @@ -227,7 +227,7 @@ def extract_preprocessing(
preproc_block = PreprocessingBlock(
mean=mean,
scale=scale,
reverse_channels=encoding.from_ != encoding.to,
reverse_channels=encoding.to == Encoding.RGB,
interleaved_to_planar=layout == "NHWC",
dai_type=dai_type,
)
Expand Down
4 changes: 2 additions & 2 deletions modelconverter/utils/nn_archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from modelconverter.utils.constants import MISC_DIR
from modelconverter.utils.layout import guess_new_layout, make_default_layout
from modelconverter.utils.metadata import get_metadata
from modelconverter.utils.types import DataType
from modelconverter.utils.types import DataType, Encoding

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -235,7 +235,7 @@ def modelconverter_config_to_nn(
if inp.scale_values
else None
),
"reverse_channels": inp.encoding.from_ != inp.encoding.to,
"reverse_channels": inp.encoding.to == Encoding.RGB,
"interleaved_to_planar": layout == "NHWC",
"dai_type": dai_type,
},
Expand Down

0 comments on commit 230b1ff

Please sign in to comment.