MCPcopy Create free account
hub / github.com/OpenShot/libopenshot / SetJsonValue

Method SetJsonValue

src/CVObjectDetection.cpp:377–414  ·  view source on GitHub ↗

Load Json::Value into this object

Source from the content-addressed store, hash-verified

375
376// Load Json::Value into this object
377void CVObjectDetection::SetJsonValue(const Json::Value root) {
378
379 // Set data from Json (if key is found)
380 if (!root["protobuf_data_path"].isNull()){
381 protobuf_data_path = (root["protobuf_data_path"].asString());
382 }
383 if (!root["processing-device"].isNull()){
384 processingDevice = (root["processing-device"].asString());
385 }
386 if (!root["model-config"].isNull()){
387 modelConfiguration = (root["model-config"].asString());
388 std::ifstream infile(modelConfiguration);
389 if(!infile.good()){
390 processingController->SetError(true, "Incorrect path to model config file");
391 error = true;
392 }
393
394 }
395 if (!root["model-weights"].isNull()){
396 modelWeights= (root["model-weights"].asString());
397 std::ifstream infile(modelWeights);
398 if(!infile.good()){
399 processingController->SetError(true, "Incorrect path to model weight file");
400 error = true;
401 }
402
403 }
404 if (!root["class-names"].isNull()){
405 classesFile = (root["class-names"].asString());
406
407 std::ifstream infile(classesFile);
408 if(!infile.good()){
409 processingController->SetError(true, "Incorrect path to class name file");
410 error = true;
411 }
412
413 }
414}
415
416/*
417||||||||||||||||||||||||||||||||||||||||||||||||||

Callers

nothing calls this directly

Calls 1

SetErrorMethod · 0.80

Tested by

no test coverage detected