snnn001 commited on
Commit
fdc3dcc
·
verified ·
1 Parent(s): 3fcb260

Update validated TorchVision exports and compatibility documentation

Browse files

Publish the reviewed model files and current CPU/GPU/NPU compatibility table.

Files changed (3) hide show
  1. README.md +14 -16
  2. resnet50.tflite +2 -2
  3. resnet50_int8_channelwise.tflite +2 -2
README.md CHANGED
@@ -43,9 +43,9 @@ The ResNet-50 architecture is a convolutional neural network pre-trained on the
43
 
44
  The model was converted from a checkpoint from PyTorch Vision.
45
 
46
- The original model has:
47
- acc@1 (on ImageNet-1K): 76.13%
48
- acc@5 (on ImageNet-1K): 92.862%
49
  num_params: 25,557,032
50
 
51
  ## Available Model Files
@@ -74,14 +74,12 @@ Calibration used real ImageNet validation images with the TorchVision ResNet
74
  preprocessing flow. When using APIs that expose raw tensor buffers, prepare the
75
  input and output using the quantization parameters stored in the model.
76
 
77
- ## Runtime Compatibility
78
 
79
- These artifacts are intended for LiteRT CPU and GPU execution. The static INT8
80
- channelwise artifact is also suitable for Qualcomm NPU deployment through the
81
- LiteRT Qualcomm compiler plugin and QNN AOT compilation on compatible Qualcomm
82
- devices.
83
-
84
- Enablement for other NPU backends is still under validation.
85
 
86
  ## Intended uses & limitations
87
 
@@ -111,20 +109,20 @@ from ai_edge_litert.compiled_model import CompiledModel
111
  def preprocess(img: Image.Image) -> np.ndarray:
112
  img = img.convert("RGB")
113
  w, h = img.size
114
- s = 256
115
  if w < h:
116
- img = img.resize((s, int(round(h * s / w))), Image.BILINEAR)
117
  else:
118
- img = img.resize((int(round(w * s / h)), s), Image.BILINEAR)
119
- left = (img.size[0] - 224) // 2
120
- top = (img.size[1] - 224) // 2
121
  img = img.crop((left, top, left + 224, top + 224))
122
 
123
  x = np.asarray(img, dtype=np.float32) / 255.0
124
  x = (x - np.array([0.485, 0.456, 0.406], dtype=np.float32)) / np.array(
125
  [0.229, 0.224, 0.225], dtype=np.float32
126
  )
127
- return np.transpose(x, (2, 0, 1))
128
 
129
  def main():
130
  ap = argparse.ArgumentParser()
 
43
 
44
  The model was converted from a checkpoint from PyTorch Vision.
45
 
46
+ The source checkpoint has:
47
+ acc@1 (on ImageNet-1K): 80.858%
48
+ acc@5 (on ImageNet-1K): 95.434%
49
  num_params: 25,557,032
50
 
51
  ## Available Model Files
 
74
  preprocessing flow. When using APIs that expose raw tensor buffers, prepare the
75
  input and output using the quantization parameters stored in the model.
76
 
77
+ ## Compatibility
78
 
79
+ | File | CPU | GPU | NPU |
80
+ |---|---|---|---|
81
+ | `resnet50.tflite` | Supported | Supported | N/A |
82
+ | `resnet50_int8_channelwise.tflite` | Supported | Not supported | Qualcomm / MediaTek |
 
 
83
 
84
  ## Intended uses & limitations
85
 
 
109
  def preprocess(img: Image.Image) -> np.ndarray:
110
  img = img.convert("RGB")
111
  w, h = img.size
112
+ s = 232
113
  if w < h:
114
+ img = img.resize((s, int(h * s / w)), Image.BILINEAR)
115
  else:
116
+ img = img.resize((int(w * s / h), s), Image.BILINEAR)
117
+ left = int(round((img.size[0] - 224) / 2.0))
118
+ top = int(round((img.size[1] - 224) / 2.0))
119
  img = img.crop((left, top, left + 224, top + 224))
120
 
121
  x = np.asarray(img, dtype=np.float32) / 255.0
122
  x = (x - np.array([0.485, 0.456, 0.406], dtype=np.float32)) / np.array(
123
  [0.229, 0.224, 0.225], dtype=np.float32
124
  )
125
+ return np.ascontiguousarray(x.transpose(2, 0, 1)[None])
126
 
127
  def main():
128
  ap = argparse.ArgumentParser()
resnet50.tflite CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:12d7455c0db04121af403c69cf3df90254536e79cbc0ea81eaa8d80ab1f42d68
3
- size 102148096
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b60ece2473934776b8de38244d1fc5d107ecebabd7080a1a19ea8c28a4643be5
3
+ size 102147184
resnet50_int8_channelwise.tflite CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:4b47a9100b1ccd66c1dd5ad59c2ef6bc1ae43dbda240cd9354e1ea874a6f0ebc
3
- size 26307408
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b5a5bcd4cc610c8bc8afb48f8d220a1716a4a0d752b6d9f3ab0e7a8e65d4f23a
3
+ size 26305808