프로그램 사용/yolo_tensorflow
tensorflow lite yolov4
구차니
2021. 6. 10. 16:15
output 텐서의 차원에 대한 정보는 세개 변수에 저장된다.
TfLiteType type; TfLiteIntArray* dims; size_t bytes; |
type은 개별 엘리먼트의 출력 포맷(float라던가 uint8 이라던가)의 변수 크기를 저장하고
dims.size 에는 몇 차원 텐서인지
dims.data[] 에는 차원별 갯수를 저장한다.
dims.size = 4
dims.data[] = [1 7 7 18] 식으로 저장되며
float32형이기에
1*7*7*18*sizeof(float) = 3528 byte로
해당 내용은 bytes에 저장된다.
TfLitePtrUnion data; |
그리고 그 용량의 데이터는 data에 저장되어 접근을 하면 되는데..
차원을 어떻게 접근해야 하려나.. -_-
대충 label_image.cc 예제에서 이런 식으로 출력하면 okay
printf("dims size[%d]\n",output_dims->size); for(int idx = 0; idx < output_dims->size; idx++) { printf("%d\t",output_dims->data[idx]); } printf("tensor pos bytes [%d]\n",interpreter->tensor(interpreter->outputs()[0])->bytes); printf("tensor per bytes [%d]\n",interpreter->tensor(interpreter->outputs()[1])->bytes); |