예제 #1
0
			def forward(self, tenFirst, tenSecond, objPrevious):
				tenFlow = None
				tenFeat = None

				if objPrevious is None:
					tenFlow = None
					tenFeat = None

					tenVolume = torch.nn.functional.leaky_relu(input=correlation.FunctionCorrelation(tenFirst=tenFirst, tenSecond=tenSecond), negative_slope=0.1, inplace=False)

					tenFeat = torch.cat([ tenVolume ], 1)

				elif objPrevious is not None:
					tenFlow = self.netUpflow(objPrevious['tenFlow'])
					tenFeat = self.netUpfeat(objPrevious['tenFeat'])

					tenVolume = torch.nn.functional.leaky_relu(input=correlation.FunctionCorrelation(tenFirst=tenFirst, tenSecond=backwarp(tenInput=tenSecond, tenFlow=tenFlow * self.fltBackwarp)), negative_slope=0.1, inplace=False)

					tenFeat = torch.cat([ tenVolume, tenFirst, tenFlow, tenFeat ], 1)

				# end

				tenFeat = torch.cat([ self.netOne(tenFeat), tenFeat ], 1)
				tenFeat = torch.cat([ self.netTwo(tenFeat), tenFeat ], 1)
				tenFeat = torch.cat([ self.netThr(tenFeat), tenFeat ], 1)
				tenFeat = torch.cat([ self.netFou(tenFeat), tenFeat ], 1)
				tenFeat = torch.cat([ self.netFiv(tenFeat), tenFeat ], 1)

				tenFlow = self.netSix(tenFeat)

				return {
					'tenFlow': tenFlow,
					'tenFeat': tenFeat
				}
예제 #2
0
    def forward(self, tenFirst, tenSecond, tenFeaturesFirst, tenFeaturesSecond, tenFlow):
        tenFeaturesFirst = self.netFeat(tenFeaturesFirst)
        tenFeaturesSecond = self.netFeat(tenFeaturesSecond)

        if tenFlow is not None:
            tenFlow = self.netUpflow(tenFlow)
        # end

        if tenFlow is not None:
            tenFeaturesSecond = backwarp(tenInput=tenFeaturesSecond, tenFlow=tenFlow * self.fltBackwarp)
        # end

        if self.netUpcorr is None:
            tenCorrelation = torch.nn.functional.leaky_relu(
                input=correlation.FunctionCorrelation(tenFirst=tenFeaturesFirst, tenSecond=tenFeaturesSecond,
                                                      intStride=1), negative_slope=0.1, inplace=False)

        elif self.netUpcorr is not None:
            tenCorrelation = self.netUpcorr(torch.nn.functional.leaky_relu(
                input=correlation.FunctionCorrelation(tenFirst=tenFeaturesFirst, tenSecond=tenFeaturesSecond,
                                                      intStride=2), negative_slope=0.1, inplace=False))

        # end

        return (tenFlow if tenFlow is not None else 0.0) + self.netMain(tenCorrelation)
예제 #3
0
            def forward(self, tensorFirst, tensorSecond, objectPrevious):
                tensorFlow = None
                tensorFeat = None

                if objectPrevious is None:
                    tensorFlow = None
                    tensorFeat = None

                    tensorVolume = torch.nn.functional.leaky_relu(
                        input=correlation.FunctionCorrelation(
                            tensorFirst=tensorFirst,
                            tensorSecond=tensorSecond),
                        negative_slope=0.1,
                        inplace=False)

                    tensorFeat = torch.cat([tensorVolume], 1)

                elif objectPrevious is not None:
                    tensorFlow = self.moduleUpflow(
                        objectPrevious['tensorFlow'])
                    tensorFeat = self.moduleUpfeat(
                        objectPrevious['tensorFeat'])

                    tensorVolume = torch.nn.functional.leaky_relu(
                        input=correlation.FunctionCorrelation(
                            tensorFirst=tensorFirst,
                            tensorSecond=backwarp(tensorInput=tensorSecond,
                                                  tensorFlow=tensorFlow *
                                                  self.dblBackwarp)),
                        negative_slope=0.1,
                        inplace=False)

                    tensorFeat = torch.cat(
                        [tensorVolume, tensorFirst, tensorFlow, tensorFeat], 1)

                # end

                tensorFeat = torch.cat(
                    [self.moduleOne(tensorFeat), tensorFeat], 1)
                tensorFeat = torch.cat(
                    [self.moduleTwo(tensorFeat), tensorFeat], 1)
                tensorFeat = torch.cat(
                    [self.moduleThr(tensorFeat), tensorFeat], 1)
                tensorFeat = torch.cat(
                    [self.moduleFou(tensorFeat), tensorFeat], 1)
                tensorFeat = torch.cat(
                    [self.moduleFiv(tensorFeat), tensorFeat], 1)

                tensorFlow = self.moduleSix(tensorFeat)

                return {'tensorFlow': tensorFlow, 'tensorFeat': tensorFeat}
예제 #4
0
            def forward(self, tensorFirst, tensorSecond, tensorFeaturesFirst,
                        tensorFeaturesSecond, tensorFlow):
                tensorFeaturesFirst = self.moduleFeat(tensorFeaturesFirst)
                tensorFeaturesSecond = self.moduleFeat(tensorFeaturesSecond)

                if tensorFlow is not None:
                    tensorFlow = self.moduleUpflow(tensorFlow)
                # end

                if tensorFlow is not None:
                    tensorFeaturesSecond = Backward(
                        tensorInput=tensorFeaturesSecond,
                        tensorFlow=tensorFlow * self.dblBackward)
                # end

                if self.moduleUpcorr is None:
                    tensorCorrelation = torch.nn.functional.leaky_relu(
                        input=correlation.FunctionCorrelation(
                            tensorFirst=tensorFeaturesFirst,
                            tensorSecond=tensorFeaturesSecond,
                            intStride=1),
                        negative_slope=0.1,
                        inplace=False)

                elif self.moduleUpcorr is not None:
                    tensorCorrelation = self.moduleUpcorr(
                        torch.nn.functional.leaky_relu(
                            input=correlation.FunctionCorrelation(
                                tensorFirst=tensorFeaturesFirst,
                                tensorSecond=tensorFeaturesSecond,
                                intStride=2),
                            negative_slope=0.1,
                            inplace=False))

                # end

                return (tensorFlow if tensorFlow is not None else
                        0.0) + self.moduleMain(tensorCorrelation)