Skip to content

Commit

Permalink
Merge pull request #273 from ria-com/v3.4
Browse files Browse the repository at this point in the history
V3.4
  • Loading branch information
ApelSYN authored Jun 5, 2023
2 parents 296662d + 9be7935 commit 743a862
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 6 additions & 0 deletions moderation/app_console/controllers/viaController.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,11 @@ async function addAttribute (options) {
attrValue = options.attrValue
;
let rewriteSettedAttribute = 1;
let rewriteEmptyValue = 1;
if (options.rewrite != undefined) { rewriteSettedAttribute = options.rewrite }
if (options.rewriteEmpty != undefined) { rewriteEmptyValue = options.rewriteEmpty }
rewriteSettedAttribute = Boolean(Number(rewriteSettedAttribute));
rewriteEmptyValue = Boolean(Number(rewriteEmptyValue));
// console.log(JSON.stringify(options))
console.log(`attrName="${attrName}"`)
console.log(`attrValue="${attrValue}"`)
Expand All @@ -128,6 +131,9 @@ async function addAttribute (options) {
for (let region of item.regions) {
if (region["region_attributes"][attrName] != undefined && (!rewriteSettedAttribute)) {
// pass
if (region["region_attributes"][attrName].trim().length == 0 && rewriteEmptyValue) {
region["region_attributes"][attrName] = attrValue
}
} else {
region["region_attributes"][attrName] = attrValue
}
Expand Down
3 changes: 1 addition & 2 deletions nomeroff_net/tools/yolo_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,7 @@ def convert_dataset_to_yolo_format(path_to_res_ann,
if region.get("region_attributes", None) is not None:
if region["region_attributes"].get("label", None) is not None:
if isinstance(region["region_attributes"]["label"], str):
if len(region["region_attributes"]["label"].lstrip().rstrip()):
label = region["region_attributes"]["label"].lstrip().rstrip()
label = region["region_attributes"]["label"]
if isinstance(region["region_attributes"]["label"], int):
if region["region_attributes"]["label"] < len(classes):
label = classes[region["region_attributes"]["label"]]
Expand Down

0 comments on commit 743a862

Please sign in to comment.