accelerated_features icon indicating copy to clipboard operation
accelerated_features copied to clipboard

OpenVINO support?

Open wattanakorn495 opened this issue 9 months ago • 2 comments

I just found OpenVINO does not support InstanceNorm https://docs.openvino.ai/2023.3/openvino_docs_ops_opset13.html

wattanakorn495 avatar May 06 '24 06:05 wattanakorn495

I think it's possible to include InstanceNorm in input preprocessing instead of in the model, or to use an equivalent replacement for InstanceNorm supported by OpenVINO. Using the source code from https://github.com/acai66/accelerated_features, applying this patch may implicitly affect performance. image

		#dont backprop through normalization
		with torch.no_grad():
			x = x.mean(dim=1, keepdim = True)
			if torch.onnx.is_in_onnx_export():
				epsilon = 0.00001
				mean = x.mean(dim=(2, 3), keepdim=True)
				std = x.std(dim=(2, 3), unbiased=False, keepdim=True)
				x = (x - mean) / (std + epsilon)
			else:
				x = self.norm(x)

		#main backbone
		x1 = self.block1(x)

acai66 avatar May 06 '24 14:05 acai66

Hello @wattanakorn495, as @acai66 mentioned, normalizing the input with standard normalization will have the same effect, thus it can be replaced as described by @acai66. It makes sense to use the same eps=1e-05 as used in the InstanceNorm2D layer.

guipotje avatar May 07 '24 12:05 guipotje

Closing the issue. If you need further clarification, please feel free to reopen it!

guipotje avatar May 20 '24 23:05 guipotje