Skip to content

Commit

Permalink
🛠 Fix openvino circular import issue (#416)
Browse files Browse the repository at this point in the history
* Fix openvino circular import issue

* Update README.md to correct openvino example.
  • Loading branch information
samet-akcay committed Jul 8, 2022
1 parent 059fd44 commit 64296d2
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 19 deletions.
15 changes: 6 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,15 +189,12 @@ optimization:
Example OpenVINO Inference:

```bash
python tools/inference.py \
--config \
anomalib/models/padim/config.yaml \
--weight_path \
results/padim/mvtec/bottle/compressed/compressed_model.xml \
--image_path \
datasets/MVTec/bottle/test/broken_large/000.png \
--meta_data \
results/padim/mvtec/bottle/compressed/meta_data.json
python tools/inference/openvino_inference.py \
--config anomalib/models/padim/config.yaml \
--weight_path results/padim/mvtec/bottle/openvino/openvino_model.bin \
--image_path datasets/MVTec/bottle/test/broken_large/000.png \
--meta_data results/padim/mvtec/bottle/openvino/meta_data.json \
--save_path results/padim/mvtec/bottle/images
```

> Ensure that you provide path to `meta_data.json` if you want the normalization to be applied correctly.
Expand Down
4 changes: 2 additions & 2 deletions anomalib/deploy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# See the License for the specific language governing permissions
# and limitations under the License.

from .inferencers import OpenVINOInferencer, TorchInferencer
from .inferencers import Inferencer, OpenVINOInferencer, TorchInferencer
from .optimize import export_convert, get_model_metadata

__all__ = ["OpenVINOInferencer", "TorchInferencer", "export_convert", "get_model_metadata"]
__all__ = ["Inferencer", "OpenVINOInferencer", "TorchInferencer", "export_convert", "get_model_metadata"]
6 changes: 3 additions & 3 deletions anomalib/deploy/inferencers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
# See the License for the specific language governing permissions
# and limitations under the License.

from .base import Inferencer
from .openvino import OpenVINOInferencer
from .torch import TorchInferencer
from .base_inference import Inferencer
from .openvino_inference import OpenVINOInferencer
from .torch_inference import TorchInferencer

__all__ = ["Inferencer", "OpenVINOInferencer", "TorchInferencer"]
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

from anomalib.pre_processing import PreProcessor

from .base import Inferencer
from .base_inference import Inferencer

if find_spec("openvino") is not None:
from openvino.inference_engine import ( # type: ignore # pylint: disable=no-name-in-module
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from anomalib.models.components import AnomalyModule
from anomalib.pre_processing import PreProcessor

from .base import Inferencer
from .base_inference import Inferencer


class TorchInferencer(Inferencer):
Expand Down
2 changes: 1 addition & 1 deletion tools/inference/gradio_inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from skimage.segmentation import mark_boundaries

from anomalib.config import get_configurable_parameters
from anomalib.deploy.inferencers.base import Inferencer
from anomalib.deploy import Inferencer
from anomalib.post_processing import compute_mask, superimpose_anomaly_map


Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@
from torchvision.datasets.folder import IMG_EXTENSIONS

from anomalib.config import get_configurable_parameters
from anomalib.deploy.inferencers import OpenVINOInferencer
from anomalib.deploy.inferencers.base import Inferencer
from anomalib.deploy import Inferencer, OpenVINOInferencer


def get_args() -> Namespace:
Expand Down

0 comments on commit 64296d2

Please sign in to comment.