2

我在和使用过不同版本的nnlibs,并对其进行编译和测试。我得到的最接近的是使用提交版本7321d49318a33a99e978b18411adee43df7ddaea(2018 年 1 月),并在运行 graph_app 时收到这个帮助程序:codeauroraSDK 3.03.23.3.3SDK 3.3.3

$ adb shell /data/graph_app

Usage: testapp [--flag flagopt] [inputfile [inputfile...]]
           flag name      type   default  function
              height       int         0  Height of the input data. 0 == autodetect-square
               width       int         0  Width of the input data. 0 == autodetect-square
               depth       int         3  Depth of the input data
               iters       int         1  Number of times to run each input
            perfdump       int         0  Generate performance dump
                 pmu       int         0  Get Performance Monitor Unit information
         elementsize       int         1  Element Size (uint8==1,float==4)
       layer_reorder    string      NULL  Reorder depth layers. ("210" changes RGB to BGR)
       pprint_floats       int         0  Pretty-Print output as floats
     pprint_imagenet       int         1  Pretty-print output, getting top 5 values and use imagenet categories
               debug       int         0  Debug verbosity level. Higher numbers get more verbosity.
           benchmark       int         0  Bechmark mode.  Reduce work at the end of execution.  Reduces messages.
              bus_bw       int         0  Collect bus BW
           node_perf       int         0  Show the cycles each node consumed in last execution
       graph_rebuild       int         0  Number of times to build/destroy the graph
         showaddress       int         0  Show the offset of some item in the .so, useful for

但是,由于图像文件中的不匹配,所有尝试都没有成功产生任何结果:

$adb shell data/graph_app --height 200 --width 200 --depth 1  --iters 1 --perfdump 0 --pmu 0  --pprint_floats 0 --pprint_imagenet 1 --debug 0 /data/keyboard_299x299.jpg
return value from dspCV_initQ6() : 0
node 66122 success
node 66304 success
node 66637 success
Init graph done.Prepare a830e780 success!
nn @ a830e780: id=0x0 debug_level=0
node @ a830ecf0: id=0x1024a type=0x0(INPUT) n_inputs=0 n_outputs=1 padding=0(WHATEVER)
node @ a830edd0: id=0x10300 type=0x2(Nop) n_inputs=1 n_outputs=1 padding=0(WHATEVER)
node @ a830eed0: id=0x1044d type=0x1(OUTPUT) n_inputs=1 n_outputs=0 padding=0(WHATEVER)
3 nodes total.
Using </data/keyboard_299x299.jpg>
image size 25763 does not match element size 1, depth 1, width 200, height 200

查看test/graph_app.c代码,我必须遵守这些规则:

if  ((filesize % elementsize != 0)
                || (elements % depth != 0)
                || (height * width != area)) {
                printf("image size %d does not match "
                        "element size %d, "
                        "depth %d, "
                        "width %d, "
                        "height %d, "
                        "elements %d, "
                        "area %d\n ",
                        filesize,
                        elementsize,
                        depth,
                        width,
                        height,
                        elements,
                        area);
                return -1;
        }

然而,当他们这样做时,应用程序会卡住Run!并且设备溢出,我必须使用 adb 重新安装才能再次访问 DSP。

另外,我尝试了最新的nnlib,似乎项目中缺少头文件:pmu_adsp.h。任何帮助表示赞赏。

更新的问题:根据@Erich Plondke 的评论,我尝试只输入一个小图像,结果如下:

21 nodes total.
Init graph done.Prepare 9a912180 success!
nn @ 9a912180: id=0x0 debug_level=0
node @ 9a912610: id=0x1000b type=0x3(Const) n_inputs=0 n_outputs=1 padding=0(WHATEVER)
node @ 9a912a20: id=0x1000c type=0x3(Const) n_inputs=0 n_outputs=1 padding=0(WHATEVER)
node @ 9a912b20: id=0x1000d type=0x3(Const) n_inputs=0 n_outputs=1 padding=0(WHATEVER)
node @ 9a912b70: id=0x1000e type=0x3(Const) n_inputs=0 n_outputs=1 padding=0(WHATEVER)
node @ 9a912c20: id=0x1000f type=0x3(Const) n_inputs=0 n_outputs=1 padding=0(WHATEVER)
node @ 9a912d30: id=0x10010 type=0x3(Const) n_inputs=0 n_outputs=1 padding=0(WHATEVER)
node @ 9a912ec0: id=0x10011 type=0x3(Const) n_inputs=0 n_outputs=1 padding=0(WHATEVER)
node @ 9a912fa0: id=0x10012 type=0x3(Const) n_inputs=0 n_outputs=1 padding=0(WHATEVER)
node @ 9a912ff0: id=0x10250 type=0x3(Const) n_inputs=0 n_outputs=1 padding=0(WHATEVER)
node @ 9a913040: id=0x1024a type=0x0(INPUT) n_inputs=0 n_outputs=1 padding=0(WHATEVER)
node @ 9a9130c0: id=0x1024b type=0xe(Flatten) n_inputs=2 n_outputs=1 padding=0(WHATEVER)
node @ 9a939af0: id=0x1024c type=0x21(Min_f) n_inputs=2 n_outputs=1 padding=0(WHATEVER)
node @ 9a939bd0: id=0x1024d type=0x23(Max_f) n_inputs=2 n_outputs=1 padding=0(WHATEVER)
node @ 9a939cb0: id=0x1024e type=0x25(Quantize) n_inputs=3 n_outputs=3 padding=0(WHATEVER)
node @ 9a93a8a0: id=0x10254 type=0x29(Supernode_8x8p8to8) n_inputs=12 n_outputs=3 padding=2(VALID)
node @ 9a93a4e0: id=0x10442 type=0x27(Dequantize) n_inputs=3 n_outputs=1 padding=0(WHATEVER)
node @ 9a93a5d0: id=0x1044d type=0x1(OUTPUT) n_inputs=1 n_outputs=0 padding=0(WHATEVER)
node @ 9a93a690: id=0xffffffff type=0x3(Const) n_inputs=0 n_outputs=1 padding=0(WHATEVER)
node @ 9a93a7a0: id=0xfffffffe type=0x3(Const) n_inputs=0 n_outputs=1 padding=0(WHATEVER)
node @ 9a93a7f0: id=0xfffffffd type=0x3(Const) n_inputs=0 n_outputs=1 padding=0(WHATEVER)
20 nodes total.
Using </data/keyboard_299x299.dat>
filesize=256 elementsize=4 height=8 width=8 depth=1
Run!
sum=0
Executing!
execute got err: -1
hexagon/ops/src/op_supernode.c:1142:oops, depth != depth
output size=4096
Rank,Softmax,index,string
0,303036292954618408664607741320364032.000000,148,keeshond
1,79327539388858010780491752432205824.000000,177,Saint Bernard
2,79327539388858010780491752432205824.000000,239,canoe
3,78932096774468846046999075786588160.000000,933,bell cote
4,78025652318903304902112439047290880.000000,350,harmonica
AppReported: 4294967296
4

1 回答 1

2

该文件pmu_adsp.h不应该被需要,可能只是某个地方的错误。

在这种特殊情况下,您可能希望输入一个非常小的文件。尝试dd if=/dev/zero of=test.dat bs=4 count=64然后尝试--height 8 --width 8 --depth 1 --elementsize 4

如果您查看代码,则可以吐出最大尺寸,默认情况下它对于简单的 nop 图来说太小了,它被设计为更适合图像识别图(未发货)。

此外,请确保您使用的是 SD820 或 SD835。其他目标可能需要您发送到“CDSP”而不是“ADSP”。如果您将它发送到没有 HVX 的 DSP 设备,它可能会挂起或崩溃。

于 2018-05-11T16:57:08.870 回答