mirror of
https://github.com/sipeed/MaixCDK.git
synced 2026-11-09 17:04:38 -06:00
fix yolov5 and classifier load single label model fail bug, and optimize cdk path check script
This commit is contained in:
@@ -162,12 +162,20 @@ namespace maix::nn
|
||||
{
|
||||
split0(labels, labels_str, ",");
|
||||
}
|
||||
else
|
||||
else if(labels_str.find(".") != std::string::npos)
|
||||
{
|
||||
label_path = fs::dirname(model) + "/" + _extra_info["labels"];
|
||||
err::Err e = _load_labels_from_file(labels, label_path);
|
||||
if (e != err::ERR_NONE)
|
||||
{
|
||||
log::error("Load labels file %s failed", label_path.c_str());
|
||||
return e;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
labels.push_back(labels_str);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -167,12 +167,21 @@ namespace maix::nn
|
||||
{
|
||||
split0(labels, labels_str, ",");
|
||||
}
|
||||
else
|
||||
else if(labels_str.find(".") != std::string::npos)
|
||||
{
|
||||
label_path = fs::dirname(model) + "/" + _extra_info["labels"];
|
||||
err::Err e = _load_labels_from_file(labels, label_path);
|
||||
if (e != err::ERR_NONE)
|
||||
{
|
||||
log::error("Load labels file %s failed", label_path.c_str());
|
||||
return e;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
labels.clear();
|
||||
labels.push_back(labels_str);
|
||||
}
|
||||
log::print("\tlabels num: %ld\n", labels.size());
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ def get_sdk_path():
|
||||
|
||||
# 1. get SDK absolute path from MAIXCDK_PATH env
|
||||
try:
|
||||
if os.environ[sdk_env_name] and os.path.exists(os.environ[sdk_env_name]):
|
||||
if os.environ[sdk_env_name]:
|
||||
sdk_path = os.environ[sdk_env_name]
|
||||
except Exception:
|
||||
pass
|
||||
@@ -26,9 +26,14 @@ def get_sdk_path():
|
||||
sdk_path = path
|
||||
|
||||
# 3. check if MaixCDK path valid
|
||||
if not sdk_path or not os.path.exists(sdk_path):
|
||||
if not sdk_path:
|
||||
print("")
|
||||
print("Error: can not find MaixCDK, please set MAIXCDK_PATH env to MaixCDK directory")
|
||||
print("Error: can not find MaixCDK, please set MAIXCDK_PATH env to MaixCDK directory by `export MAIXCDK_PATH=xxxxx`")
|
||||
print("")
|
||||
sys.exit(1)
|
||||
if not os.path.exists(sdk_path):
|
||||
print("")
|
||||
print(f"Error: MaixCDK set to {sdk_path}, but not exists!")
|
||||
print("")
|
||||
sys.exit(1)
|
||||
return os.path.abspath(sdk_path)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
|
||||
|
||||
__version__ = "1.2.1"
|
||||
__version__ = "1.2.2"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user