You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: EvalCoSegAP.m
    path of file: ./repos/DeepCO3/Lib/InstCosegEval
    
    the code of the file until where you have to start completion: function [APAll, Overlap, NumInsts] = EvalCoSegAP(PredMasks, PredMasksScores, GTInstMasks, Threshold)
% PredMasks: the Masks from the algorthm
% PredMasks: the Mask scores from the algorthm
% GTInstMasks: the ground thruth of the instances
% APAll: the average precision at thresholds in Threshold
NumImgs = length(PredMasks);

    
function [APAll, Overlap, NumInsts] = EvalCoSegAP(PredMasks, PredMasksScores, GTInstMasks, Threshold)
% PredMasks: the Masks from the algorthm
% PredMasks: the Mask scores from the algorthm
% GTInstMasks: the ground thruth of the instances
% APAll: the average precision at thresholds in Threshold
NumImgs = length(PredMasks);
Overlap = cell(1, NumImgs);
NumInsts = cell(1, NumImgs);
for i=1:NumImgs
    if(rem(i-1,10)==0) 
        fprintf('Computing overlaps:%d/%d\n',i, NumImgs); 
    end