예제 #1
0
            
                # determine msmt probability from sample vs from new object
                prepped_sample = prepSample(sample)
                llfromsample = likelihood(prepped_sample, msmtprepped)
                llfromnew = nllnewobject
                print(llfromsample - llfromnew)
                assert llfromsample - llfromnew < 10
            
                # update sample
                if llfromsample - llfromnew < 10:
                    sample = update(sample, prepped_sample, msmtprepped)
                
        validSample(sample)
        assert sample[0] > -5 and sample[0] < 70 and abs(sample[1]) < 50
        
        plotimg = plotImgKitti(view_angle)
        # draw object
        if havemsmtactually:
            box = np.array(gtobj['box'])
            addRect2KittiImg(plotimg, box, (0,0,256,1.))
        # plot fake measurement
        if havemsmt:
            box = msmt.copy()#[[1,2,0,3,4]].copy()
            addRect2KittiImg(plotimg, box, (0,256*.2,0,.2))
        # plot tracked sample
        if not samplenotset:
            box = sample[:5].copy()
            addRect2KittiImg(plotimg, box, (256*.4,0,0,.4))

        plotimg = np.minimum((plotimg[:,:,:3]/plotimg[:,:,3:]),255.).astype(np.uint8)
        # put the plot on top of the camera image to view, display for 3 seconds      
예제 #2
0
    reportedobjects = np.array(reportedobjects).reshape((-1, 5))
    reportedscores = np.array(reportedscores)
    reportedlabels = np.array(reportedlabels)
    metric.add(np.array([gtobj['box'] for gtobj in gt]),
               np.array([gtobj['scored'] for gtobj in gt]),
               np.array([gtobj['difficulty'] for gtobj in gt]),
               reportedobjects, reportedscores)
    np.save(
        outestimatefiles.format(scene_idx, fileidx),
        np.concatenate(
            (reportedobjects, reportedscores[:, None], reportedlabels[:,
                                                                      None]),
            axis=1))

    # visualize
    plotimg1 = plotImgKitti(view_angle)
    plotimg2 = plotImgKitti(view_angle)
    # shade tiles chosen for detection
    for tilex, tiley in np.ndindex(*grndlen):
        if not tiles2detectgrid[tilex, tiley] or empty[tilex, tiley]: continue
        tilecenterx = (tilex + grndstart[0] + .5) * grndstep[0]
        tilecentery = (tiley + grndstart[1] + .5) * grndstep[1]
        addRect2KittiImg(plotimg1, (tilecenterx, tilecentery, 0., 1.5, 1.5),
                         np.array((30., 30., 30., .2)))
    # add ground truth
    for gtobj in gt:
        box = np.array(gtobj['box'])
        if gtobj['scored']:
            addRect2KittiImg(plotimg1, box, (0, 0, 210 * .9, .9))
        else:
            addRect2KittiImg(plotimg1, box, (30 * .9, 80 * .9, 255 * .9, .9))