|
16 | 16 | */
|
17 | 17 |
|
18 | 18 | /*
|
19 |
| -rm classification/tflite_classification & make -f Makefile-rv |
| 19 | +rm -f classification/tflite_classification && make -f Makefile-rv |
| 20 | +
|
20 | 21 | qemu-riscv64 classification/tflite_classification -m \
|
21 | 22 | classification/imagenet_mobilenet_v1_100_224_classification.tflite -i \
|
22 | 23 | classification/dog.jpg -l classification/labels.txt -c 1 -b 0 -s 255 -t 1
|
| 24 | +# label: Blenheim spaniel with probability 18.3755 |
| 25 | +
|
| 26 | +qemu-riscv64 classification/tflite_classification -m \ |
| 27 | +classification/imagenet_mobilenet_v2_100_224_classification.tflite -i \ |
| 28 | +classification/dog.jpg -l classification/labels.txt -c 1 -b 0 -s 255 -t 1 |
| 29 | +# label: Blenheim spaniel with probability 9.8589 |
| 30 | +
|
| 31 | +qemu-riscv64 classification/tflite_classification -m \ |
| 32 | +classification/imagenet_inception_v1_classification_5.tflite -i \ |
| 33 | +classification/dog.jpg -l classification/labels.txt -c 1 -b 0 -s 255 -t 1 |
| 34 | +# label: Blenheim spaniel with probability 10.9008 |
| 35 | +
|
| 36 | +qemu-riscv64 classification/tflite_classification -m \ |
| 37 | +classification/imagenet_inception_v2_classification_5.tflite -i \ |
| 38 | +classification/dog.jpg -l classification/labels.txt -c 1 -b 0 -s 255 -t 1 |
| 39 | +# label: Blenheim spaniel with probability 11.0233 有bug |
| 40 | +
|
| 41 | +qemu-riscv64 classification/tflite_classification -m \ |
| 42 | +classification/imagenet_resnet_v1_50_classification_5.tflite -i \ |
| 43 | +classification/dog.jpg -l classification/labels.txt -c 1 -b 0 -s 255 -t 1 |
| 44 | +# label: Blenheim spaniel with probability 16.8781 |
| 45 | +
|
| 46 | +qemu-riscv64 classification/tflite_classification -m \ |
| 47 | +classification/imagenet_resnet_v2_50_classification_5.tflite -i \ |
| 48 | +classification/dog.jpg -l classification/labels.txt -c 1 -b 0 -s 255 -t 1 |
| 49 | +# label: Blenheim spaniel with probability 19.5378 |
| 50 | +
|
23 | 51 | */
|
24 | 52 |
|
25 | 53 | #include <getopt.h>
|
@@ -115,6 +143,23 @@ void display_usage() {
|
115 | 143 | << "--threads, -t: number of threads\n"
|
116 | 144 | << "\n";
|
117 | 145 | }
|
| 146 | + |
| 147 | +#ifdef MEM_PROFILE |
| 148 | + |
| 149 | +#ifdef __cplusplus |
| 150 | +extern "C" { |
| 151 | +#endif |
| 152 | +extern size_t packed_weight_in_byte; |
| 153 | +extern size_t packed_feature_in_byte; |
| 154 | + |
| 155 | +extern size_t packed_weight_access_in_byte; |
| 156 | +extern size_t packed_feature_access_in_byte; |
| 157 | +#ifdef __cplusplus |
| 158 | +} |
| 159 | +#endif |
| 160 | + |
| 161 | +#endif |
| 162 | + |
118 | 163 | // (input - mean) / std
|
119 | 164 | /*
|
120 | 165 | * Main function
|
@@ -332,7 +377,18 @@ int main(int argc, char **argv) {
|
332 | 377 |
|
333 | 378 | std::cout << "Classification complete ! " << std::endl;
|
334 | 379 |
|
335 |
| - // IMPORTANT: release the interpreter before destroying the delegate |
| 380 | +#ifdef MEM_PROFILE |
| 381 | + std::cout << "packed_weight_in_byte = " << packed_weight_in_byte << std::endl |
| 382 | + << "packed_feature_in_byte = " << packed_feature_in_byte |
| 383 | + << std::endl |
| 384 | + << "packed_weight_access_in_byte = " << packed_weight_access_in_byte |
| 385 | + << std::endl |
| 386 | + << "packed_feature_access_in_byte = " |
| 387 | + << packed_feature_access_in_byte << std::endl; |
| 388 | +#endif |
| 389 | + |
| 390 | + // IMPORTANT: release the interpreter before destroying the |
| 391 | + // delegate |
336 | 392 | interpreter.reset();
|
337 | 393 | // TfLiteXNNPackDelegateDelete(xnnpack_delegate);
|
338 | 394 |
|
|
0 commit comments