예제 #1
0
 def __getitem__(self, item):
     # Get parameter
     gp = GlobalProperties()
     camMat = gp.getCamMat()
     # Sampling for reprojection error image
     sampling = cnn.stochasticSubSample(self.imgBGR,
                                        targetsize=self.objInputSize,
                                        patchsize=self.rgbInputSize)
     estObj = cnn.getCoordImg(self.imgBGR, sampling, self.rgbInputSize,
                              self.model)
     # Produce GroundTruth Label
     poseGT = Hypothesis()
     poseGT.Info(self.info)
     driftLevel = np.random.randint(0, 3)
     if not driftLevel:
         poseNoise = poseGT * getRandHyp(2, 2)
     else:
         poseNoise = poseGT * getRandHyp(10, 100)
     data = cnn.getDiffMap(
         TYPE.our2cv([poseNoise.getRotation(),
                      poseNoise.getTranslation()]), estObj, sampling,
         camMat)
     data = self.transform(data)
     label = -1 * self.temperature * max(
         poseGT.calcAngularDistance(poseNoise),
         np.linalg.norm(poseGT.getTranslation() -
                        poseNoise.getTranslation()) / 10.0)
     return data, label
    def __getitem__(self, item):

        # Get raw data
        imgBGR = self.dataset.rand_getBGR(item)
        info = self.dataset.rand_getInfo(item)
        poseGT = Hypothesis()
        poseGT.Info(info)

        # Sampling for reprojection error image
        sampling = cnn.stochasticSubSample(imgBGR,
                                           targetsize=self.objInputSize,
                                           patchsize=self.rgbInputSize)
        estObj = cnn.getCoordImg1(imgBGR, sampling, self.rgbInputSize,
                                  self.model)

        return imgBGR, poseGT, sampling, estObj