This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TDA4VM: Image classification model issue

Part Number: TDA4VM


Hi Team, 

We are trying to create an application with an image classification model.

The model is not TI provided. But we have tested the model inference using TI_DEVICE_a72_test_dl_algo_host_rt.out. 

We are getting the expected results.

Then we started implementing the application with the same model.

our pipeline is 

tivximgPreProcNode -> TIDLNode -> tivxOCPostProcNode
I am using just Processgraph to run the graph.
With the above pipeline, we are not getting the expected output.
Can anyone please suggest, how to solve this issue?

Thanks and Regards,

Aneesh

  • The model only does binary classification (0/1) not like TI image classification model

    Can anyone suggest what modifications I need to make it work in the above pipeline?

    I have dumped the tidl output and preprocess output  using the write_tildoutput and write_preprocoutput functions.

    Surprisingly the output of all the frames of the preprocessing looks similar. I have verified the hex data.

    The preproc output I am getting is in .rgb files. I am not able to view it like an image. Please suggest some tools to view the image.

    The tidl output is coming like a pattern first 0 and then 1 , 0, 1,0, 1. like this.

    I am not able to figure out the exact issue. 

    Regards,

    Aneesh

  • Hi Aneesh,

    If the output of preprocess block is same, then it is just the TIDL node, not outputting correctly? Can you please step in the code on TIDL node and see if it is running fine and processing as expected? 

    Regards,

    Brijesh

  • Hi Brijesh,

    The output of the preprocess looks something like this "hosw_preproc_out318_224x224_ch0.rgb".  I am not able to open this file. I have compared the hexadecimal data of the two preprocess output files. Both look similar. I have not compared the input preprocess  with the preprocess output.

    Question:  My understanding is that the outputs of preprocess should not be similar when we compare them with each other. Please correct me if my understanding is wrong.

    The input to the tivximgPreProcNode is VX_DF_IMAGE_RGB type.

    Please let me know if there are any tools to view the output of the preprocess.

    Thanks and Regards,

    Aneesh

  • My model datatype is float32. I saw the tivximgPreProcNode code, but I don't see the preprocess code for the float32 type. I found the tivxDlPreProcNode. Could you please provide any use case using the tivxDlPreProcNode with RGB input?

    Thanks and Regards,

    Aneesh

  • Hi Aneesh,

    Yes, you are correct. 
    tivximgPreProcNode does not support the datatype float.
    Hence you could use tivxDlPreProcNode to transforms input image to a format as required for DL processing.

    Unfortunately, we do not have a example or usecase in the SDK for this node. 
    You could refer this link for reference 


    https://github.com/TexasInstruments/edgeai-tiovx-modules/blob/83e7a97e53f12a9541d761551ece9a7eee918dea/test/app_tiovx_dl_pre_proc_module_test.c


    Could you please try it this way and please let me know if you are facing any issue here.

    Regards,
    Nikhil

  • Hi Nikhil,

    I have tried with tivxDLPreProcNode but I am getting the below tivxMemBufferMap error while mapping the image data. I have added vx_print in the target node code.

    I have added prints like below in the vx_dl_pre_proc_target.c code on line 231

    =================================================Code=============================================

    config_desc = (tivx_obj_desc_user_data_object_t *)obj_desc[TIVX_KERNEL_DL_PRE_PROC_CONFIG_IDX];
            config_target_ptr = tivxMemShared2TargetPtr(&config_desc->mem_ptr);
            tivxMemBufferMap(config_target_ptr, config_desc->mem_size, VX_MEMORY_TYPE_HOST,VX_READ_ONLY);
            VX_PRINT(VX_ZONE_ERROR, "[%s] \n", "config");

            in_img_desc  = (tivx_obj_desc_image_t *)obj_desc[TIVX_KERNEL_DL_PRE_PROC_INPUT_IMAGE_IDX];
            in_img_target_ptr[0]  = tivxMemShared2TargetPtr(&in_img_desc->mem_ptr[0]);
            tivxMemBufferMap(in_img_target_ptr[0], in_img_desc->mem_size[0], VX_MEMORY_TYPE_HOST, VX_READ_ONLY);
            in_img_target_ptr[1]  = NULL;
            VX_PRINT(VX_ZONE_ERROR, "[%s][%d] \n", "image",in_img_desc->mem_size[0]);
            if(in_img_desc->mem_ptr[1].shared_ptr != 0)
            {
                VX_PRINT(VX_ZONE_ERROR, "[%s][%d] \n", "image1",in_img_desc->mem_size[1]);
                in_img_target_ptr[1]  = tivxMemShared2TargetPtr(&in_img_desc->mem_ptr[1]);
                tivxMemBufferMap(in_img_target_ptr[1], in_img_desc->mem_size[1], VX_MEMORY_TYPE_HOST, VX_READ_ONLY);
            }

            out_tensor_desc = (tivx_obj_desc_tensor_t *)obj_desc[TIVX_KERNEL_DL_PRE_PROC_OUTPUT_TENSOR_IDX];
            out_tensor_target_ptr = tivxMemShared2TargetPtr(&out_tensor_desc->mem_ptr);
            tivxMemBufferMap(out_tensor_target_ptr, out_tensor_desc->mem_size, VX_MEMORY_TYPE_HOST, VX_WRITE_ONLY);
            VX_PRINT(VX_ZONE_ERROR, "[%s] \n", "tensor");
     
    =================================================Error Log================================================================

    [C6x_1 ] 5282.090599 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:235] [config]
    [C6x_1 ] 5282.090624 s: VX_ZONE_ERROR:[tivxMemBufferMap:309] tivxMemBufferMap failed (either pointer is NULL or size is 0)
    [C6x_1 ] 5282.090643 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:241] [image][209664]
    [C6x_1 ] 5282.090726 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:252] [tensor]
    [C6x_1 ] 5282.090741 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:254] Image channel 0
    [C6x_1 ] 5282.090757 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:255] dim_x = 224
    [C6x_1 ] 5282.090772 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:256] dim_y = 224
    [C6x_1 ] 5282.090787 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:257] stride_y = 936
    [C6x_1 ] 5282.090803 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:258] stride_x = 3
    [C6x_1 ] 5282.090818 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:259] step_x = 1
    [C6x_1 ] 5282.090834 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:260] step_y = 1
    [C6x_1 ] 5282.090849 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:273] Tensor input
    [C6x_1 ] 5282.090865 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:274] stride[0] = 4
    [C6x_1 ] 5282.090880 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:275] stride[1] = 896
    [C6x_1 ] 5282.090896 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:276] stride[2] = 200704
    [C6x_1 ] 5282.090913 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:277] dimensions[0] = 224
    [C6x_1 ] 5282.090930 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:278] dimensions[1] = 224
    [C6x_1 ] 5282.090946 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:279] dimensions[2] = 3
    [C6x_1 ] 5282.094841 s: VX_ZONE_ERROR:[tivxMemBufferUnmap:335] tivxMemBufferUnmap failed (either pointer is NULL or size is 0)
    [C6x_1 ] 5282.205171 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:235] [config]
    [C6x_1 ] 5282.205195 s: VX_ZONE_ERROR:[tivxMemBufferMap:309] tivxMemBufferMap failed (either pointer is NULL or size is 0)
    [C6x_1 ] 5282.205215 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:241] [image][209664]
    [C6x_1 ] 5282.205300 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:252] [tensor]
    [C6x_1 ] 5282.205314 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:254] Image channel 0
    [C6x_1 ] 5282.205330 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:255] dim_x = 224
    [C6x_1 ] 5282.205346 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:256] dim_y = 224
    [C6x_1 ] 5282.205361 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:257] stride_y = 936
    [C6x_1 ] 5282.205377 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:258] stride_x = 3
    [C6x_1 ] 5282.205392 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:259] step_x = 1
    [C6x_1 ] 5282.205407 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:260] step_y = 1
    [C6x_1 ] 5282.205422 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:273] Tensor input
    [C6x_1 ] 5282.205438 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:274] stride[0] = 4
    [C6x_1 ] 5282.205453 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:275] stride[1] = 896
    [C6x_1 ] 5282.205470 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:276] stride[2] = 200704
    [C6x_1 ] 5282.205486 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:277] dimensions[0] = 224
    [C6x_1 ] 5282.205502 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:278] dimensions[1] = 224
    [C6x_1 ] 5282.205519 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:279] dimensions[2] = 3
    [C6x_1 ] 5282.209372 s: VX_ZONE_ERROR:[tivxMemBufferUnmap:335] tivxMemBufferUnmap failed (either pointer is NULL or size is 0)
    [C6x_1 ] 5282.329494 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:235] [config]
    [C6x_1 ] 5282.329518 s: VX_ZONE_ERROR:[tivxMemBufferMap:309] tivxMemBufferMap failed (either pointer is NULL or size is 0)
    [C6x_1 ] 5282.329537 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:241] [image][209664]
    [C6x_1 ] 5282.329620 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:252] [tensor]
    [C6x_1 ] 5282.329634 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:254] Image channel 0
    [C6x_1 ] 5282.329650 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:255] dim_x = 224
    [C6x_1 ] 5282.329665 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:256] dim_y = 224
    [C6x_1 ] 5282.329681 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:257] stride_y = 936
    [C6x_1 ] 5282.329696 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:258] stride_x = 3
    [C6x_1 ] 5282.329712 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:259] step_x = 1
    [C6x_1 ] 5282.329727 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:260] step_y = 1
    [C6x_1 ] 5282.329742 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:273] Tensor input
    [C6x_1 ] 5282.329758 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:274] stride[0] = 4
    [C6x_1 ] 5282.329773 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:275] stride[1] = 896
    [C6x_1 ] 5282.329790 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:276] stride[2] = 200704
    [C6x_1 ] 5282.329806 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:277] dimensions[0] = 224
    [C6x_1 ] 5282.329822 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:278] dimensions[1] = 224
    [C6x_1 ] 5282.329839 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:279] dimensions[2] = 3
    [C6x_1 ] 5282.333693 s: VX_ZONE_ERROR:[tivxMemBufferUnmap:335] tivxMemBufferUnmap failed (either pointer is NULL or size is 0)
    [C6x_1 ] 5282.453281 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:235] [config]
    [C6x_1 ] 5282.453306 s: VX_ZONE_ERROR:[tivxMemBufferMap:309] tivxMemBufferMap failed (either pointer is NULL or size is 0)
    [C6x_1 ] 5282.453326 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:241] [image][209664]
    [C6x_1 ] 5282.453409 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:252] [tensor]
    [C6x_1 ] 5282.453424 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:254] Image channel 0
    [C6x_1 ] 5282.453440 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:255] dim_x = 224
    [C6x_1 ] 5282.453455 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:256] dim_y = 224
    [C6x_1 ] 5282.453471 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:257] stride_y = 936
    [C6x_1 ] 5282.453487 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:258] stride_x = 3
    [C6x_1 ] 5282.453502 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:259] step_x = 1
    [C6x_1 ] 5282.453518 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:260] step_y = 1
    [C6x_1 ] 5282.453533 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:273] Tensor input
    [C6x_1 ] 5282.453549 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:274] stride[0] = 4
    [C6x_1 ] 5282.453564 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:275] stride[1] = 896
    [C6x_1 ] 5282.453580 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:276] stride[2] = 200704
    [C6x_1 ] 5282.453597 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:277] dimensions[0] = 224
    [C6x_1 ] 5282.453613 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:278] dimensions[1] = 224
    [C6x_1 ] 5282.453630 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:279] dimensions[2] = 3
    [C6x_1 ] 5282.457487 s: VX_ZONE_ERROR:[tivxMemBufferUnmap:335] tivxMemBufferUnmap failed (either pointer is NULL or size is 0)
    [C6x_1 ] 5282.577465 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:235] [config]
    [C6x_1 ] 5282.577489 s: VX_ZONE_ERROR:[tivxMemBufferMap:309] tivxMemBufferMap failed (either pointer is NULL or size is 0)
    [C6x_1 ] 5282.577509 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:241] [image][209664]
    [C6x_1 ] 5282.577592 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:252] [tensor]
    [C6x_1 ] 5282.577606 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:254] Image channel 0
    [C6x_1 ] 5282.577622 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:255] dim_x = 224
    [C6x_1 ] 5282.577637 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:256] dim_y = 224
    [C6x_1 ] 5282.577653 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:257] stride_y = 936
    [C6x_1 ] 5282.577669 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:258] stride_x = 3
    [C6x_1 ] 5282.577684 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:259] step_x = 1
    [C6x_1 ] 5282.577700 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:260] step_y = 1
    [C6x_1 ] 5282.577714 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:273] Tensor input
    [C6x_1 ] 5282.577730 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:274] stride[0] = 4
    [C6x_1 ] 5282.577746 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:275] stride[1] = 896
    [C6x_1 ] 5282.577762 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:276] stride[2] = 200704
    [C6x_1 ] 5282.577778 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:277] dimensions[0] = 224
    [C6x_1 ] 5282.577795 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:278] dimensions[1] = 224
    [C6x_1 ] 5282.577811 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:279] dimensions[2] = 3
    [C6x_1 ] 5282.581647 s: VX_ZONE_ERROR:[tivxMemBufferUnmap:335] tivxMemBufferUnmap failed (either pointer is NULL or size is 0)
    [C6x_1 ] 5282.716207 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:235] [config]
    [C6x_1 ] 5282.716232 s: VX_ZONE_ERROR:[tivxMemBufferMap:309] tivxMemBufferMap failed (either pointer is NULL or size is 0)
    [C6x_1 ] 5282.716251 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:241] [image][209664]
    [C6x_1 ] 5282.716339 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:252] [tensor]
    [C6x_1 ] 5282.716354 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:254] Image channel 0
    [C6x_1 ] 5282.716370 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:255] dim_x = 224
    [C6x_1 ] 5282.716385 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:256] dim_y = 224
    [C6x_1 ] 5282.716401 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:257] stride_y = 936
    [C6x_1 ] 5282.716417 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:258] stride_x = 3
    [C6x_1 ] 5282.716433 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:259] step_x = 1
    [C6x_1 ] 5282.716448 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:260] step_y = 1
    [C6x_1 ] 5282.716463 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:273] Tensor input
    [C6x_1 ] 5282.716479 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:274] stride[0] = 4
    [C6x_1 ] 5282.716495 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:275] stride[1] = 896
    [C6x_1 ] 5282.716511 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:276] stride[2] = 200704
    [C6x_1 ] 5282.716527 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:277] dimensions[0] = 224
    [C6x_1 ] 5282.716544 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:278] dimensions[1] = 224
    [C6x_1 ] 5282.716560 s: VX_ZONE_ERROR:[tivxKernelDLPreProcProcess:279] dimensions[2] = 3
    [C6x_1 ] 5282.720880 s: VX_ZONE_ERROR:[tivxMemBufferUnmap:335] tivxMemBufferUnmap failed (either pointer is NULL or size is 0)

    =================================================================================================================

    Also, I am not using the pipelining technique for running the graph I am using the processgraph() function to run the graph.

    Regards,

    Aneesh

  • Hi Nikhil and Brijesh,

    Thank you very much for the discussion.

    As discussed, Please share the two methods Brijesh suggested for copying the memory in the discussion. 

    I will try and update the feedback.

    Regards,

    Aneesh

  • Hello Aneesh,

    As per today's discussion, the issue seems to be in the memory allocation that is done by the OpenCV using malloc.

    As discussed in the meeting, please try the below two methods and check if the issue is still seen,

    1. Do a mem_cpy from the memory location allocated in OpenCV to the OpenVX allocated memory for the vx_image. (i.e. avoid creating image from the handle).

    2. Allocate the memory for the vx_image on OpenVX and map this memory to the OpenCV so that the image is directly written into this address location.

    You could use vxMapImagePatch() and vxUnmapImagePatch() to access a pointer to the memory allocated by OpenVX.

    Regards,
    Nikhil

  • Hi Nikhil,

    I have tried method 1 but still I am facing the issue.

    =============================================method 1 code ===========================================

               
               
               
                obj->rsz_image  = vxCreateImage(obj->context, 224, 224, VX_DF_IMAGE_RGB);
                vxQueryImage(hobj->rsz_image, (vx_enum)VX_IMAGE_WIDTH, &widthOut, sizeof(vx_uint32));
                vxQueryImage(hobj->rsz_image, (vx_enum)VX_IMAGE_HEIGHT, &heightOut, sizeof(vx_uint32));
                vxQueryImage(hobj->rsz_image, (vx_enum)VX_IMAGE_FORMAT, &dfOut, sizeof(vx_df_image));

               
       
                rectOut.start_x = 0;
                rectOut.start_y = 0;
                rectOut.end_x = widthOut;
                rectOut.end_y = heightOut;

                status = vxMapImagePatch(hobj->rsz_image,
                    &rectOut,
                    0,
                    &map_idOut,
                    &image_addrOut,
                    &data_ptrOut,
                    (vx_enum)VX_WRITE_ONLY,
                    (vx_enum)VX_MEMORY_TYPE_HOST,
                    (vx_enum)VX_NOGAP_X
                    );

                image_addrOut.dim_x = widthOut;
                image_addrOut.dim_y = heightOut;
                image_addrOut.stride_x = (int32_t)input_frame.elemSize();
                image_addrOut.stride_y = (int32_t)input_frame.step;

                printf("height: %d width: %d stride_x: %d stride_y: %d \n",image_addrOut.dim_x,image_addrOut.dim_y,image_addrOut.stride_x,image_addrOut.stride_y);

                // for(int i = 0; i < heightOut; i++)
                // {
                //     vx_uint8 *pIn  = (vx_uint8 *)input_frame.data + (i * image_addrOut.stride_y);
                //     vx_uint8 *pOut = (vx_uint8 *)data_ptrOut + (i * image_addrOut.stride_y);
                //     uint32_t offset;

                //     offset = 0;
                //     for(int j = 0; j < widthOut; j++)
                //     {
                //         vx_uint8 R = pIn[offset + 0];
                //         vx_uint8 G = pIn[offset + 1];
                //         vx_uint8 B = pIn[offset + 2];

                //         pOut[offset + 0] = (vx_uint8)R;
                //         pOut[offset + 1] = (vx_uint8)G;
                //         pOut[offset + 2] = (vx_uint8)B;

                //         offset += 3;
                //     }
                // }

                printf("input %X , output %X \n",(vx_uint8*)data_ptrOut,(vx_uint8*)input_frame.data);
                memcpy((vx_uint8*)data_ptrOut,(vx_uint8*)input_frame.data,heightOut*widthOut*3);

                vxUnmapImagePatch(hobj->rsz_image, map_idOut);
    =======================================================================================================
     
    After this, I tried to save the image using the 
    tivx_utils_save_vximage_to_bmpfile(buffer_vximage1,hobj->rsz_image);
    but the image is not saving as expected. I have attached one for reference.
    I will try method2 and share the feedback.
    Also,  i have tried to copy the data pixel by pixel. but still i am getting the same wrong output.
    Please look into the code and let me know if I am making any mistakes in the code.
    I am doing the memcpy after the verify graph.
    Thanks and Regards,
    Aneesh
  • Hi Nikhil,

    I am trying method 2 also but I am still facing the issue. please help me solve this issue.

    Regards,

    Aneesh

  • Hi Aneesh,

    I think the issue is here in the stride.

      image_addrOut.dim_x = widthOut;
      image_addrOut.dim_y = heightOut;
      image_addrOut.stride_x = (int32_t)input_frame.elemSize();
      image_addrOut.stride_y = (int32_t)input_frame.step;

    The image_addOut is the address of a structure describing the memory layout of the image patch to access.
    Here the function fills the structure pointed by addr with the layout information that the application must consult to access/write the pixel data at address data_ptrOut.

    Hence one should not modify this.

    Could you try without modifying image_addrOut?

    Regards,
    Nikhil
  • Hi Nikhil, 

    I am able to fix the memory mapping issue.

    Thanks and Regards,

    Aneesh