Skip to content

Conversation

@mbsaloka
Copy link
Member

Jira Link:

Description

Set blob size based on width and height on yolo config

Type of Change

  • Bugfix
  • Enhancement
  • New feature
  • Breaking change (fix or feature that would cause the existing functionality to not work as expected)

How Has This Been Tested?

  • New unit tests added.
  • Manual tested.

Checklist:

  • Using Branch Name Convention
    • feature/JIRA-ID-SHORT-DESCRIPTION if has a JIRA ticket
    • enhancement/SHORT-DESCRIPTION if has/has no JIRA ticket and contain enhancement
    • hotfix/SHORT-DESCRIPTION if the change doesn't need to be tested (urgent)
  • I have commented on my code, particularly in hard-to-understand areas.
  • I have made the documentation for the corresponding changes.

@mbsaloka mbsaloka changed the title feat: read size from cfg [Enhancement] Set Blob Size Based On YOLO Config Jul 13, 2024
Comment on lines 51 to 58
while (std::getline(ifs_cfg, cfg_line)) {
if (cfg_line.find("width") != std::string::npos) {
width = std::stoi(jitsuyo::split_string(cfg_line, "="));
} else if (cfg_line.find("height") != std::string::npos) {
height = std::stoi(jitsuyo::split_string(cfg_line, "="));
break;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This loop assumes that width is always above height in the cfg. You can do something like this in case the cfg is written otherwise:

Suggested change
while (std::getline(ifs_cfg, cfg_line)) {
if (cfg_line.find("width") != std::string::npos) {
width = std::stoi(jitsuyo::split_string(cfg_line, "="));
} else if (cfg_line.find("height") != std::string::npos) {
height = std::stoi(jitsuyo::split_string(cfg_line, "="));
break;
}
}
int flag = 0;
while (std::getline(ifs_cfg, cfg_line)) {
if (flag >= 2) break;
if (cfg_line.find("width") != std::string::npos) {
width = std::stoi(jitsuyo::split_string(cfg_line, "="));
flag++;
} else if (cfg_line.find("height") != std::string::npos) {
height = std::stoi(jitsuyo::split_string(cfg_line, "="));
flag++;
}
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (height != 0 && width != 0) {
  break;
}

instead of flag, what about this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ow yeah, that's better

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants