| 207 | } |
| 208 | |
| 209 | std::vector<float> InferenceTestImage::Resize(unsigned int newWidth, |
| 210 | unsigned int newHeight, |
| 211 | const armnn::CheckLocation& location, |
| 212 | const ResizingMethods meth, |
| 213 | const std::array<float, 3>& mean, |
| 214 | const std::array<float, 3>& stddev, |
| 215 | const float scale) |
| 216 | { |
| 217 | std::vector<float> out; |
| 218 | if (newWidth == 0 || newHeight == 0) |
| 219 | { |
| 220 | throw InferenceTestImageResizeFailed(fmt::format("None of the dimensions passed to a resize " |
| 221 | "operation can be zero. Requested width: {0}. Requested height: {1}.", newWidth, newHeight)); |
| 222 | } |
| 223 | |
| 224 | switch (meth) { |
| 225 | case ResizingMethods::STB: |
| 226 | { |
| 227 | StbResize(*this, newWidth, newHeight); |
| 228 | break; |
| 229 | } |
| 230 | case ResizingMethods::BilinearAndNormalized: |
| 231 | { |
| 232 | out = ResizeBilinearAndNormalize(*this, newWidth, newHeight, scale, mean, stddev); |
| 233 | break; |
| 234 | } |
| 235 | default: |
| 236 | throw InferenceTestImageResizeFailed(fmt::format("Unknown resizing method asked ArmNN only" |
| 237 | " supports {STB, BilinearAndNormalized} {}", |
| 238 | location.AsString())); |
| 239 | } |
| 240 | return out; |
| 241 | } |
| 242 | |
| 243 | void InferenceTestImage::Write(WriteFormat format, const char* filePath) const |
| 244 | { |
no test coverage detected