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.

TDA2EXEVM: How could genetate raw image file from jpg img file for TIDL?

Part Number: TDA2EXEVM

Hi:

   How could I generate raw image file(like preproc_0_224x224.y) from myself .jpg file?

   what is format of the raw image ,RGB888 or R-channle,G-channel,B-channel?

    PLS help me!

   Thanks!

  • Hi,

    Please check if the point 2) in Kumar's answer here can help you:
    e2e.ti.com/.../2424411

    Regards,
    Yordan
  • Hi:
    I thins so too,but I write a programm to validate it:convert .y file to jpg image.I found the "preproc_0_224x224.y"'s data format is "R-plan,G-plan,B-plan";but the "preproc_3_32x32" 's data format is "B-plan,G-plan,R-plan";and "preproc_1_227x227.y" is other unknow format.
    Is that so?
    here is my validate code:



    #define RAWFILE_WIDTH 32
    #define RAWFILE_HEIGHT 32
    FILE *rawFile =NULL;
    fopen_s(&rawFile,"preproc_3_32x32.y","rb");
    if(rawFile==NULL)
    {
    cout<<"rawFile open fail!"<<endl;
    return -1;
    }
    int ret = 0;

    Mat red = cv::Mat::zeros(RAWFILE_HEIGHT, RAWFILE_WIDTH, CV_8UC1);
    Mat green = cv::Mat::zeros(RAWFILE_HEIGHT, RAWFILE_WIDTH, CV_8UC1);
    Mat blue = cv::Mat::zeros(RAWFILE_HEIGHT, RAWFILE_WIDTH, CV_8UC1);

    ret = fread(red.data,sizeof(uchar),RAWFILE_WIDTH*RAWFILE_HEIGHT,rawFile);
    ret = fread(green.data,sizeof(uchar),RAWFILE_WIDTH*RAWFILE_HEIGHT,rawFile);
    ret = fread(blue.data,sizeof(uchar),RAWFILE_WIDTH*RAWFILE_HEIGHT,rawFile);

    vector<Mat> tmp;
    tmp.push_back(red);
    tmp.push_back(green);
    tmp.push_back(blue);
    cv::Mat bgr;
    cv::merge(tmp, bgr);

    imshow("raw2img",bgr);
    waitKey();
  • Hi,
    Basic Idea is that the input format shall be same as the input tensor of Network used during training.
    Some models are trained with RGB, some are trained with BGR ans some are with just gray scale image.
    preproc_1_227x227.y is input used for tensor flow trained models. These models are trained with input ranges from -127 to 127 (-1 to 1). So the are signed input. We have parameter in import config file to specify the input tensor format "inElementType". Please refer users guide for more details on import config parameters.



    Hope this helps.
  • Hi,
    Thanks!very helpful!

    Regards