Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix openvino circular import issue #416

Merged
merged 2 commits into from
Jul 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"]
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