Как я могу вычислить True / Table, Recall & Precision? - PullRequest
0 голосов
/ 16 января 2019

Я хочу создать программу, которая читает 3 разных видеофайла, извлекает 2 кадра из каждого видео, я выполнил порог и пересечение гистограммы. Теперь я хочу создать таблицу, которая содержит значения True / False для извлеченных кадров и вычислений, Recall, Precision и F1.

Как рассчитать истинное положительное, ложное положительное и ложное отрицание для каждого пересечения?

Как сохранить результат на столе?

Чтобы вычислить точность для каждого пересечения, нам нужно Presision = истинно положительный / истинно положительный + ложный положительный

Вычисление отзыва для каждого пересечения

Напомним = истинно положительный // истинно положительный / + ложный отрицательный

Вычислить F1 для каждого пересечения F1 = 2 * [(P * R) / P + R]

Может кто-нибудь дать мне указание о том, как найти значение true / false и как сохранить мой результат в таблице.

Заранее спасибо.

function [output]= calculate_TruthTable(filename, 
    fimename01,fimename02)
    % the First Video

    filename='C:\Users\User\Videos\videos\TestSet\01_DevilsAdvocate_01.mp4'; 

    % From the first video we extract frame 40
    % Convert the frame to greyscale
    % Perform threshold
    % Compute histogrma
    % Normalize histogram
    vObj= VideoReader(filename);
    vFrame01 = read(vObj, 40);
    vFrame01grey = rgb2gray(vFrame01);
    binaryImage = vFrame01grey < 40;
    hist01=imhist(binaryImage);
    hist01=hist01 ./max(abs(hist01));

    % From the same video extract frame 135
    % Convert the frame to grayscale
    % Perform threshold
    % Compute Histogram
    % Normalize histogram
    vFrame02 = read(vObj, 135);
    vFrame02grey = rgb2gray(vFrame02);
    binaryImage02 = vFrame02grey < 40;
    hist02=imhist(binaryImage02);
    hist02=hist02 ./max(abs(hist02));

    % Find Histogram Intersection for the forst video
    histIntersect= sum(max(hist01-hist02));
    Intersect = find(histIntersect);

    %-------------------------------------------------------------------- 
    ------------------------------------------------------%
    % the Second Video

    fimename01= 
    'C:\Users\User\Videos\videos\TestSet\01_PulpFiction_01.mp4'; 


    % From the second videoextract frame 40
    % Convert the frame to greyscale
    % Perform threshold
    % Compute histogrma
    % Normalize histogram
    vObj= VideoReader(filename);
    vFrame03 = read(vObj, 40);
    vFrame03grey = rgb2gray(vFrame03);
    binaryImage03 = vFrame03grey < 40;
    hist03=imhist(binaryImage03);
    hist03=hist03 ./max(abs(hist03));

    % From the same video extract frame 135
    % Convert the frame to grayscale
    % Perform threshold
    % Compute Histogram
    % Normalize histogram
    vFrame04 = read(vObj, 135);
    vFrame04grey = rgb2gray(vFrame04);
    binaryImage04 = vFrame04grey < 40;
    hist04=imhist(binaryImage04);
    hist04=hist04 ./max(abs(hist04));

    % Compute histogram intersection
    mysec_histIntersect= sum(max(hist03-hist04));
    myInter02 = sort(mysec_histIntersect); 

    %------------------------------------------------------------------- 
    --------------------------------------------------------%
    % the Third Video

    fimename02= 
   'C:\Users\User\Videos\videos\TestSet\02_HowSheMove_01.mp4'; 

    % From the third video extract frame 40
    % Convert the frame to greyscale
    % Perform threshold
    % Compute histogrma
    % Normalize histogram
    vObj= VideoReader(filename);
    vFrame05 = read(vObj, 40);
    vFrame05grey = rgb2gray(vFrame05);
    binaryImage05 = vFrame05grey < 40;
    hist05=imhist(binaryImage05);
    hist05=hist05 ./max(abs(hist05));

    % From the same video extract frame 135
    % Convert the frame to grayscale
    % Perform threshold
    % Compute Histogram
    % Normalize histogram
    vFrame06 = read(vObj, 60);
    vFrame06grey = rgb2gray(vFrame06);
    binaryImage06 = vFrame06grey < 40;
    hist06=imhist(binaryImage06);
    hist06=hist06 ./max(abs(hist06));

    % Compute histogram intersection
    mythird_histIntersect= sum(max(hist05-hist06));

    MovieName = {'DevilsAdvocate';'PulpFiction';'HowSheMov'};

    MovieGenre= {'Thriller';'Thriller';'Dance'};

    True= {''; '';'';'';'' };
    False= {''; '';'';'';'' };
    Recall= {''; '';'';'';'' };
    Precision={'';'';'';'';''};
    F1={'';'';'';'';''};

    TruthTable = 
     table(MovieName,MovieGenre,True,False,Recall,Precision,F1);

    output= sortrows(TruthTable);
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...