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.

AM62A3: sdk 9.1

Part Number: AM62A3
Other Parts Discussed in Thread: TDA4VM
  1. As we know, TI has implemented two sets of SDKs: Edge AI SDK (Runtime API) and Processor SDK demo (vision_apps).
  2. We are using the Processor SDK in our project.
  3. Recently, we encountered some issues: our code does not run on the 9.1 SDK (while it works well on 8.6).
  4. We have made some effort to resolve the problem:
    1. Running our model using the Edge AI SDK (Runtime API) demo, and the results were correct.
    2. Running our model using the Processor SDK demo (vision_apps), but the results were incorrect. By the way, we need modify some makefile script in order to pass compiling.
  5. Could you please tell us what's the differences between the Processor SDK versions 8.6 and 9.1.
  6. We need some assistance in getting our model to work on version 9.1 with Processor SDK.
  • Hello Yang Yong,

    Models compiled for a version of our SDK (e.g. 8.6) are not compatible with other versions, (e.g. 9.1). Have you recompiled your model for 9.1?

    If you call one of the existing models from the Edge AI SDK with your program, does the model run correctly? Ignore postprocessing for this, if possible. I suggest this because I want to verify that your model runs in the updated SDK. I expect it to, since you say so in point 4a. Please confirm.

    Can you describe what parts of your application are failing or not providing functionally correct results? Please mention the functions / call stack where this occurs. It is possible some of the APIs changed

    I assume you have the firmware builder (this is similar but not identical to PSDK RTOS for Jacinto devices). Release notes for firmware-builder are scattered within that release (under NDA). I will have to check if we have a singular list of changes for AM62A vision_apps components.

    Best,
    Reese

  • There were some significant changes to vision_apps in the 8.6 to 9.0 SDK transition. There is a migration doc in the J721e/TDA4VM PSDK-RTOS pages. This is not availabe for AM62A because vision_apps is not directly supported by the team managing AM62A. However, the same steps should still apply for migrating vision_apps

    https://software-dl.ti.com/jacinto7/esd/processor-sdk-rtos-jacinto7/09_01_00_06/exports/docs/psdk_rtos/docs/user_guide/developer_notes_migration_guide.html 

    -Reese

  • 1. We re exported the model using SDK 9.1 tidl tools.The two codes did not encounter any errors during runtime.

    2. Our programs are all running on the 9.1 system, and the firmware is also the same.

    3. We ran our model using the sdk9.1 tool and the result was correct

    4. We ran the same model using the following tool, but the result was incorrect

    5. We found that the app_tidl tool needs to modify the makefile and comment out the display related code before it can be compiled

    6. We have added code for writing output in app_tidl.

    static void recordOutput(AppObj *obj, vx_user_data_object config,
                             vx_tensor *output_tensors, char *output_file) {
      vx_status status = VX_SUCCESS;
    
      vx_size output_sizes[APP_MAX_TENSOR_DIMS];
    
      int32_t id;
    
      sTIDL_IOBufDesc_t *ioBufDesc;
    
      // Draw2D_FontPrm sClassPrm;
    
      ioBufDesc = &obj->ioBufDesc;
    
      vx_map_id map_id;
      vx_uint32 capacity;
      void *outArgs_buffer = NULL;
      capacity = sizeof(TIDL_outArgs);
      vxMapUserDataObject(obj->outArgs, 0, capacity, &map_id,
                          (void **)&outArgs_buffer, VX_WRITE_ONLY,
                          VX_MEMORY_TYPE_HOST, 0);
      TIDL_outArgs *prms = (TIDL_outArgs *)outArgs_buffer;
      for (id = 0; id < ioBufDesc->numOutputBuf; id++) {
        // vx_size data_type=VX_TYPE_INT8;
        vx_size data_type = getTensorDataType(ioBufDesc->outElementType[id]);
        printf("####### recordOutput data_type: %d\n", (int)data_type);
        output_sizes[0] = ioBufDesc->outWidth[id] + ioBufDesc->outPadL[id] +
                          ioBufDesc->outPadR[id];
        output_sizes[1] = ioBufDesc->outHeight[id] + ioBufDesc->outPadT[id] +
                          ioBufDesc->outPadB[id];
        output_sizes[2] = ioBufDesc->outNumChannels[id];
    
        status = vxGetStatus((vx_reference)output_tensors[id]);
    
        float scale = prms->scale[id];
    
        if (VX_SUCCESS == status) {
          void *output_buffer;
    
          vx_map_id map_id_output;
    
          vx_size output_strides[APP_MAX_TENSOR_DIMS];
          vx_size start[APP_MAX_TENSOR_DIMS];
    
          start[0] = start[1] = start[2] = start[3] = 0;
    
          output_strides[0] = sizeof(vx_int8);
    
          if ((data_type == VX_TYPE_INT8) || (data_type == VX_TYPE_UINT8)) {
            output_strides[0] = sizeof(vx_int8);
          } else if ((data_type == VX_TYPE_INT16) ||
                     (data_type == VX_TYPE_UINT16)) {
            output_strides[0] = sizeof(vx_int16);
          } else if (data_type == VX_TYPE_FLOAT32) {
            output_strides[0] = sizeof(vx_float32);
          }
          printf("####### recordOutput output_strides[0]: %d\n",
                 (int)output_strides[0]);
    
          output_strides[1] = output_sizes[0] * output_strides[0];
          output_strides[2] = output_sizes[1] * output_strides[1];
    
          status = tivxMapTensorPatch(
              output_tensors[id], 3, start, output_sizes, &map_id_output,
              output_strides, &output_buffer, VX_READ_ONLY, VX_MEMORY_TYPE_HOST);
    
          int full_width = ioBufDesc->outWidth[id] + ioBufDesc->outPadL[id] +
                           ioBufDesc->outPadR[id];
          int full_height = ioBufDesc->outHeight[id] + ioBufDesc->outPadT[id] +
                            ioBufDesc->outPadB[id];
    
          int16_t *p = (int16_t *)output_buffer;
          FILE *fp = NULL;
          char strW2[255] = {0};
          sprintf(strW2, "pic_%s_result_id_%d.csv", output_file,
                  ioBufDesc->outDataId[id]);
          fp = fopen(strW2, "w+");
          for (int i = 0; i < ioBufDesc->outNumChannels[id]; i++) {
            for (int j = ioBufDesc->outPadT[id];
                 j < ioBufDesc->outHeight[id] + ioBufDesc->outPadT[id]; j++) {
              for (int k = ioBufDesc->outPadL[id];
                   k < ioBufDesc->outWidth[id] + ioBufDesc->outPadL[id]; k++) {
                fprintf(
                    fp, "%lf,\n",
                    p[i * full_width * full_height + j * full_width + k] / scale);
              }
            }
          }
          fclose(fp);
    
          tivxUnmapTensorPatch(output_tensors[id], map_id_output);
        }
      }
      vxUnmapUserDataObject(obj->outArgs, map_id);
      tivx_utils_bmp_read_release(&obj->imgParams);
    
      APP_PRINTF("app_tidl: Showing output ... Done.\n");
    }

    6.1.Here is one of the results we have output.There are many identical numbers, but the result is incorrect.

     pic_28.bmp_result_id_134.csv

  • Thank you for clarifying and providing this information. Given that all the output values are identical, this seems like an incorrect output for the model (although I'm not sure what type of model this is).

    Are they any VX errors being printed? If you are on linux, please run the /opt/vx_app_arm_remote_log.out executable in the background to see all the openVX messages.

    My initial estimate based on the output is that the memory mapping for the output tensor is incorrect or being overwritten by dummy data. That seems surprising since I can tell you mostly copied that code from displayOutput(...) that retrieves the output tensor data. The calls here are not using TIDL-RT, and I'm not very familiar with the base TIDL API calls as they're being used here

    Can you describe the issue with the display code that prevented compilation?

    Note that we are migrating our TIOVX demos to use tiovx-apps in the next release. We have limited support for vision_apps on AM62A

    BR,
    Reese

  • Adding further, I do not expect this application to work on AM62A. Only a reduced set of applications are validated on AM62A, as seen in lines 16-32 of the makefile here: https://git.ti.com/cgit/processor-sdk/vision_apps/tree/Makefile?h=main#n16. I believe this has been the case since 9.0 when there was a large refactor in vision_apps. 

    -Reese