Skip to content

Commit

Permalink
Prohibit whitespace errors and non ASCII chars (openvinotoolkit#56)
Browse files Browse the repository at this point in the history
  • Loading branch information
Wovchena authored May 10, 2023
1 parent e86a632 commit a84e648
Show file tree
Hide file tree
Showing 21 changed files with 76 additions and 75 deletions.
1 change: 0 additions & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,3 @@ Fixes # (issue)
- [ ] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
- [ ] Did you make sure to update the documentation with your changes?
- [ ] Did you write any new necessary tests?

1 change: 0 additions & 1 deletion .github/workflows/test_accuracy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,3 @@ jobs:
- name: Run CPP Test
run: |
build/test_accuracy -d data -p tests/python/accuracy/public_scope.json
8 changes: 7 additions & 1 deletion .github/workflows/test_precommit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: git --no-pager diff --check $(git hash-object -t tree /dev/null)
run: git --no-pager diff --check $(git hash-object -t tree /dev/null)
- name: Prohibit non ASCII chars in file names
run: test $(git diff --name-only --diff-filter=A -z $(git hash-object -t tree /dev/null) | LC_ALL=C tr -d '[ -~]\0' | wc -c) == 0
- name: "! git grep -n '[^ -~]' -- ':(exclude)model_api/python/openvino/model_api/README.md'"
run: "! git grep -n '[^ -~]' -- ':(exclude)model_api/python/openvino/model_api/README.md'"
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
Expand Down Expand Up @@ -75,7 +81,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: cppcheck
uses: chmorgan/cppcheck-action@main
with:
Expand Down
2 changes: 1 addition & 1 deletion examples/cpp/synchronous_api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ This example demonstrates how to use a C++ API of OpenVINO Model API for synchro
```
- Build:
```
make -j
make -j
```
- Download a model by running a Python code with Model API, see Python [exaple](../../python/synchronous_api/README.md):
```python
Expand Down
2 changes: 1 addition & 1 deletion examples/python/serving_api/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Serving API example
This example demonstrates how to use a Python API of OpenVINO Model API for a remote inference of models hosted with [OpenVINO Model Server](https://docs.openvino.ai/latest/ovms_what_is_openvino_model_server.html). This tutorial assumes that you are familiar with Docker subsystem and includes the following steps:
- Run Docker image with
- Run Docker image with
- Instantiate a model
- Run inference
- Process results
Expand Down
2 changes: 0 additions & 2 deletions model_api/cpp/adapters/src/openvino_adapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,5 +84,3 @@ std::vector<std::string> OpenVINOInferenceAdapter::getOutputNames() const {
const ov::AnyMap& OpenVINOInferenceAdapter::getModelConfig() const {
return modelConfig;
}


Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class ModelCenterNet : public DetectionModel {

ModelCenterNet(std::shared_ptr<ov::Model>& model, const ov::AnyMap& configuration);
ModelCenterNet(std::shared_ptr<InferenceAdapter>& adapter);

std::shared_ptr<InternalModelData> preprocess(const InputData& inputData, InferenceInput& input) override;
std::unique_ptr<ResultBase> postprocess(InferenceResult& infResult) override;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class ModelRetinaFace : public DetectionModelExt {
public:
static const int LANDMARKS_NUM = 5;
static const int INIT_VECTOR_SIZE = 200;

ModelRetinaFace(std::shared_ptr<ov::Model>& model, const ov::AnyMap& configuration);
ModelRetinaFace(std::shared_ptr<InferenceAdapter>& adapter);
using DetectionModelExt::DetectionModelExt;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class ModelRetinaFacePT : public DetectionModelExt {
ModelRetinaFacePT(std::shared_ptr<ov::Model>& model, const ov::AnyMap& configuration);
ModelRetinaFacePT(std::shared_ptr<InferenceAdapter>& adapter);
using DetectionModelExt::DetectionModelExt;

std::unique_ptr<ResultBase> postprocess(InferenceResult& infResult) override;
static std::string ModelType;

Expand Down
2 changes: 1 addition & 1 deletion model_api/cpp/models/include/models/model_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class ModelBase {
ModelBase(const std::string& modelFile, const std::string& layout = "");
ModelBase(std::shared_ptr<InferenceAdapter>& adapter);
ModelBase(std::shared_ptr<ov::Model>& model, const ov::AnyMap& configuration);

virtual ~ModelBase() = default;

std::shared_ptr<ov::Model> prepare();
Expand Down
4 changes: 2 additions & 2 deletions model_api/cpp/models/src/classification_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ void ClassificationModel::updateModelInfo() {
std::unique_ptr<ClassificationModel> ClassificationModel::create_model(const std::string& modelFile, const ov::AnyMap& configuration, bool preload) {
auto core = ov::Core();
std::shared_ptr<ov::Model> model = core.read_model(modelFile);

// Check model_type in the rt_info, ignore configuration
std::string model_type = ClassificationModel::ModelType;
try {
Expand All @@ -138,7 +138,7 @@ std::unique_ptr<ClassificationModel> ClassificationModel::create_model(const std
} catch (const std::exception& e) {
slog::warn << "Model type is not specified in the rt_info, use default model type: " << model_type << slog::endl;
}

if (model_type != ClassificationModel::ModelType) {
throw ov::Exception("Incorrect or unsupported model_type is provided in the model_info section: " + model_type);
}
Expand Down
4 changes: 2 additions & 2 deletions model_api/cpp/models/src/detection_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ std::unique_ptr<DetectionModel> DetectionModel::create_model(const std::string&
} else {
throw ov::Exception("Incorrect or unsupported model_type is provided in the model_info section: " + model_type);
}

detectionModel->prepare();
if (preload) {
detectionModel->load(core);
Expand Down Expand Up @@ -126,7 +126,7 @@ std::unique_ptr<DetectionModel> DetectionModel::create_model(std::shared_ptr<Inf
} else {
throw ov::Exception("Incorrect or unsupported model_type is provided: " + model_type);
}

return detectionModel;
}

Expand Down
2 changes: 1 addition & 1 deletion model_api/cpp/models/src/detection_model_ssd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ void ModelSSD::prepareInputsOutputs(std::shared_ptr<ov::Model>& model) {
inputLayout,
resizeMode,
interpolationMode,
ov::Shape{shape[ov::layout::width_idx(inputLayout)],
ov::Shape{shape[ov::layout::width_idx(inputLayout)],
shape[ov::layout::height_idx(inputLayout)]});

netInputWidth = shape[ov::layout::width_idx(inputLayout)];
Expand Down
2 changes: 1 addition & 1 deletion model_api/cpp/models/src/detection_model_yolo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ static inline float linear(float x) {
}

ModelYolo::ModelYolo(std::shared_ptr<ov::Model>& model, const ov::AnyMap& configuration)
: DetectionModelExt(model, configuration) {
: DetectionModelExt(model, configuration) {
auto anchors_iter = configuration.find("anchors");
if (anchors_iter == configuration.end()) {
if (model->has_rt_info("model_info", "anchors")) {
Expand Down
2 changes: 1 addition & 1 deletion model_api/cpp/models/src/image_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ std::shared_ptr<ov::Model> ImageModel::embedProcessing(std::shared_ptr<ov::Model
bool brg2rgb,
const std::vector<float>& mean,
const std::vector<float>& scale) {

ov::preprocess::PrePostProcessor ppp(model);

inputTransform.setPrecision(ppp, inputName);
Expand Down
3 changes: 1 addition & 2 deletions model_api/cpp/utils/include/utils/image_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,5 @@ cv::Mat resizeImageExt(const cv::Mat& mat, int width, int height, RESIZE_MODE re
cv::Scalar BorderConstant = cv::Scalar(0, 0, 0));

ov::preprocess::PostProcessSteps::CustomPostprocessOp createResizeGraph(RESIZE_MODE resizeMode,
const ov::Shape& size,
const ov::Shape& size,
const cv::InterpolationFlags interpolationMode = cv::INTER_LINEAR);

Loading

0 comments on commit a84e648

Please sign in to comment.