From: jijoong.moon Date: Mon, 26 Nov 2018 06:42:53 +0000 (+0900) Subject: [Repo/RNN] Add dummy RNN test case X-Git-Tag: v0.0.3~16 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ebda5cfcd4d070d465141a803e9e3b3a4744dfcf;p=platform%2Fupstream%2Fnnstreamer.git [Repo/RNN] Add dummy RNN test case In order to test recurtion & Tensor repo, dumm RNN test case is added. It generate 10 4x4x4x1 tensors and use first input of RNN. Second input for RNN is generated by tensor_reposrc which take from Tensor_Repo. Of course, the first tensor of tensor_reposrc is filled with zero. After simple calcution, RNN (build/nnstreamer_exampel/custom_exampe_RNN/libdummyRNN.so ) push the result and tensor_reposink upload this output into Tensor_Repo. **Self evaluation:** 1. Build test: [X]Passed [ ]Failed [ ]Skipped 2. Run test: [X]Passed [ ]Failed [ ]Skipped Signed-off-by: jijoong.moon --- diff --git a/tests/recurrent_pipeline/generateTestCase.py b/tests/nnstreamer_repo_rnn/generateTestCase.py similarity index 58% rename from tests/recurrent_pipeline/generateTestCase.py rename to tests/nnstreamer_repo_rnn/generateTestCase.py index 78277f3..b3bd865 100644 --- a/tests/recurrent_pipeline/generateTestCase.py +++ b/tests/nnstreamer_repo_rnn/generateTestCase.py @@ -8,6 +8,7 @@ # @brief Generate a sequence of video/x-raw frames # @todo Generate corresponding golden results # @author MyungJoo Ham +# @author Jijoong Moon # @url https://github.com/nnsuite/nnstreamer/issues/738 @@ -17,10 +18,13 @@ import sys import os import array as arr +def location(c, w, h): + return c+4*(w+4*h) + ## # @brief Generate a video/x-raw single frame # @return The frame buffer contents -def genFrame(seq): +def genFrame(seq, out): frame = arr.array('B', [0] * 64) width = 4 height = 4 @@ -39,13 +43,34 @@ def genFrame(seq): # (RED, 1, 1), 0 to 255 frame[bpp * ( 1 + width * 1 ) + 2] = seq # R - return frame.tostring() + for h in range(0,4): + w=0 + for i in range(0,4): + out[location(i,w,h)]=frame[location(i,w,h)] + for w in range(1,3): + for c in range(0,4): + sum = frame[location(0,w,h)] + sum += out[location(0,w,h)] + out[location(0,w,h)] = sum/2 + w=3 + for i in range(0,4): + out[location(i,w,h)] = out[location(i,w,h)] + + return frame.tostring(), out filename = "video_4x4xBGRx.xraw" f = open(filename, "w") -for seq in range(0, 256): - f.write(genFrame(seq)) +out = arr.array('B',[0]*64) + +for seq in range(0, 10): + outfilename = "rnn.golden" + string, out=genFrame(seq,out) + if(seq == 9): + with open(outfilename,'wb') as file: + file.write(out.tostring()) + + f.write(string) f.close() diff --git a/tests/nnstreamer_repo_rnn/runTest.sh b/tests/nnstreamer_repo_rnn/runTest.sh new file mode 100755 index 0000000..3a8c875 --- /dev/null +++ b/tests/nnstreamer_repo_rnn/runTest.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash +## +## @file runTest.sh +## @author MyungJoo Ham +## @author Jijoong Moon +## @date Nov 01 2018 +## @brief This is a template file for SSAT test cases. You may designate your own license. +## +if [[ "$SSATAPILOADED" != "1" ]] +then + SILENT=0 + INDEPENDENT=1 + search="ssat-api.sh" + source $search + printf "${Blue}Independent Mode${NC} +" +fi +testInit $1 # You may replace this with Test Group Name + +# Generate video_4x4xBGRx.xraw +python generateTestCase.py + +gstTest "--gst-plugin-path=../../build tensor_mux name=mux ! tensor_filter framework=custom model=../../build/nnstreamer_example/custom_example_RNN/libdummyRNN.so ! tee name=t ! queue ! tensor_reposink slot-index=0 silent=false filesrc location=\"video_4x4xBGRx.xraw\" ! application/octet-stream ! tensor_converter input-dim=4:4:4:1 input-type=uint8 ! mux.sink_0 tensor_reposrc slot-index=0 silent=false caps=\"other/tensor, dim1=4, dim2=4, dim3=4, dim4=1, type=uint8, framerate=30/1\" ! mux.sink_1 t. ! queue ! multifilesink location=\"out_%1d.log\"" 1 0 0 $PERFORMANCE + +callCompareTest rnn.golden out_9.log 1-1 "Compare 1-1" 1 0 + +report diff --git a/tests/recurrent_pipeline/runTest.sh b/tests/recurrent_pipeline/runTest.sh deleted file mode 100755 index 070fafa..0000000 --- a/tests/recurrent_pipeline/runTest.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env bash -## -## @file runTest.sh -## @author MyungJoo Ham -## @date Nov 01 2018 -## @brief This is a template file for SSAT test cases. You may designate your own license. -## -if [[ "$SSATAPILOADED" != "1" ]] -then - SILENT=0 - INDEPENDENT=1 - search="ssat-api.sh" - source $search - printf "${Blue}Independent Mode${NC} -" -fi -testInit $1 # You may replace this with Test Group Name - -# Generate video_4x4xBGRx.xraw -python generateTestCase.py - -# This test case is WIP. So do not fail unittest even if this case fails. -gstTest "filesrc location=video_4x4xBGRx.xraw ! application/octet-stream ! tensor_converter input-dim=4:4:4:1 input-type=uint8 ! fakesink" 1R 1 0 0 - -report