Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ void Renderer::convert_prims_color(std::vector<render::Prim> &prims) {
render::Circle circle = std::get<render::Circle>(p);
circle.color = _color_converter->convert(circle.color);
p = circle;
} else if (std::holds_alternative<render::InstanceSegmantationMask>(p)) {
render::InstanceSegmantationMask mask = std::get<render::InstanceSegmantationMask>(p);
mask.color = _color_converter->convert(mask.color);
p = mask;
}
}
}
Expand Down
10 changes: 0 additions & 10 deletions src/monolithic/gst/inference_elements/base/inference_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -478,18 +478,8 @@ void UpdateConfigWithLayerInfo(const std::vector<ModelInputProcessorInfo::Ptr> &
config[KEY_BASE][KEY_PIXEL_VALUE_MEAN] = three_doubles_to_str(mean);
}

int reverse_channels = 0; // TODO: verify that channel reversal works correctly with mean and std!
if (gst_structure_get_int(it->params, "reverse_input_channels", &reverse_channels)) {
config[KEY_BASE][KEY_MODEL_FORMAT] = reverse_channels ? "RGB" : "BGR";
}

const auto color_space = gst_structure_get_string(it->params, "color_space");
if (color_space) {
// Ensure that reverse_input_channels and color_space are not both defined
if (reverse_channels != 0 && color_space != nullptr) {
throw std::invalid_argument(
"ERROR: Cannot specify both 'reverse_input_channels' and 'color_space' parameters simultaneously");
}
config[KEY_BASE][KEY_MODEL_FORMAT] = color_space;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -603,8 +603,16 @@ std::map<std::string, GstStructure *> get_model_info_preproc(const std::shared_p
std::transform(element.second.as<std::string>().begin(), element.second.as<std::string>().end(),
element.second.as<std::string>().begin(), ::tolower);

if (element.second.as<std::string>() == "yes" || element.second.as<std::string>() == "true")
GValue color_value = G_VALUE_INIT;
g_value_init(&color_value, G_TYPE_STRING);
if (element.second.as<std::string>() == "yes" || element.second.as<std::string>() == "true") {
g_value_set_int(&gvalue, gint(true));
Comment thread
tjanczak marked this conversation as resolved.
Outdated
g_value_set_string(&color_value, "RGB");
} else {
g_value_set_string(&color_value, "BGR");
}
gst_structure_set_value(s, "color_space", &color_value);
Comment thread
marcin-wadolkowski marked this conversation as resolved.
g_value_unset(&color_value);

gst_structure_set_value(s, "reverse_input_channels", &gvalue);
GST_INFO("[get_model_info_preproc] reverse_input_channels: %s", element.second.as<std::string>().c_str());
Expand Down
Loading