Skip to content
This repository was archived by the owner on Aug 3, 2019. It is now read-only.
This repository was archived by the owner on Aug 3, 2019. It is now read-only.

Version-10 not supported #20

@samhodge

Description

@samhodge

I got the following error

(tensorflow-1.12.0-src) kaos-new:plaid-maskrcnn sam$ python dirty.py 
Traceback (most recent call last):
  File "dirty.py", line 49, in <module>
    rep = onnx_plaidml.backend.prepare(model, device='GPU')
  File "/Users/sam/dev/virtualenv/tensorflow-1.12.0-src/lib/python3.6/site-packages/onnx_plaidml/backend.py", line 249, in prepare
    ops = _load_ops(model.opset_import)
  File "/Users/sam/dev/virtualenv/tensorflow-1.12.0-src/lib/python3.6/site-packages/onnx_plaidml/backend.py", line 77, in _load_ops
    domain, version)), None)
  File "<string>", line 3, in raise_from
NotImplementedError: ""/version=10" is not implemented by the PlaidML ONNX backend

When running the following test code


import onnx
import onnx_plaidml.backend
import onnx.numpy_helper

data_path = "//Users/sam/dev/plaid-maskrcnn/test_data_set_0/input_0.pb"
tensor = onnx.TensorProto()
with open(data_path, 'rb') as f:
	tensor.ParseFromString(f.read())
x = onnx.numpy_helper.to_array(tensor)
model_path = "/Users/sam/dev/plaid-maskrcnn/mask_rcnn_R_50_FPN_1x.onnx"
model = onnx.load(model_path)


import numpy as np
from PIL import Image

def preprocess(image):
    # Resize
    ratio = 800.0 / min(image.size[0], image.size[1])
    image = image.resize((int(ratio * image.size[0]), int(ratio * image.size[1])), Image.BILINEAR)

    # Convert to BGR
    image = np.array(image)[:, :, [2, 1, 0]].astype('float32')

    # HWC -> CHW
    image = np.transpose(image, [2, 0, 1])

    # Normalize
    mean_vec = np.array([102.9801, 115.9465, 122.7717])
    for i in range(image.shape[0]):
        image[i, :, :] = image[i, :, :] - mean_vec[i]

    # Pad to be divisible of 32
    import math
    padded_h = int(math.ceil(image.shape[1] / 32) * 32)
    padded_w = int(math.ceil(image.shape[2] / 32) * 32)

    padded_image = np.zeros((3, padded_h, padded_w), dtype=np.float32)
    padded_image[:, :image.shape[1], :image.shape[2]] = image
    image = padded_image

    return image

img = Image.open('/Users/sam/Downloads/VER01_010_plateD_v0001.1008.png')
img_data = preprocess(img)


rep = onnx_plaidml.backend.prepare(model, device='GPU')
for batch in range(1):
    data = img['inputs'][batch, :]
    output = rep.run([data])
    print(output)

Just trying to see if it possible to run maskrcnn on plaidml for GPU acceleration on a non NVIDIA GPU.

But it seems that onnx-plaidml is no longer maintained.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions