ravens/models/regression.py
def train_place_conditioned_on_pick(self, in_img, p, q, theta):
        """
          Regress pixel p to pixel q.
          Args:
            input:
            p: pixel (y, x)
            q: pixel (y, x)
        """
        self.metric.reset_states()
        with tf.GradientTape() as tape:
            output = self.forward(in_img)
            delta_pixel = np.array(q) - np.array(p)
            yxtheta = np.array([delta_pixel[0], delta_pixel[1], theta])
            loss = self.loss_criterion(yxtheta, output)

        grad = tape.gradient(loss, self.model.trainable_variables)
        self.optim.apply_gradients(zip(grad, self.model.trainable_variables))

        self.metric(loss)
        return np.float32(loss)

          Regress pixel p to pixel q.
          Args:
            input:
            p: pixel (y, x)
            q: pixel (y, x)
        
Regress pixel p to pixel q.
Regress pixel p to pixel q .
def train_place_conditioned_on_pick(self, in_img, p, q, theta):
        self.metric.reset_states()
        with tf.GradientTape() as tape:
            output = self.forward(in_img)
            delta_pixel = np.array(q) - np.array(p)
            yxtheta = np.array([delta_pixel[0], delta_pixel[1], theta])
            loss = self.loss_criterion(yxtheta, output)
        grad = tape.gradient(loss, self.model.trainable_variables)
        self.optim.apply_gradients(zip(grad, self.model.trainable_variables))
        self.metric(loss)
        return np.float32(loss)
def train_place_conditioned_on_pick ( self , in_img , p , q , theta ) : self . metric . reset_states ( ) with tf . GradientTape ( ) as tape : output = self . forward ( in_img ) delta_pixel = np . array ( q ) - np . array ( p ) yxtheta = np . array ( [ delta_pixel [ 0 ] , delta_pixel [ 1 ] , theta ] ) loss = self . loss_criterion ( yxtheta , output ) grad = tape . gradient ( loss , self . model . trainable_variables ) self . optim . apply_gradients ( zip ( grad , self . model . trainable_variables ) ) self . metric ( loss ) return np . float32 ( loss )
Regress pixel p to pixel q.
Regress pixel p to pixel q .
"""
          Regress pixel p to pixel q.
          Args:
            input:
            p: pixel (y, x)
            q: pixel (y, x)
        """
self
in_img
p
pixel (y, x)
pixel ( y x )
q
pixel (y, x)
pixel ( y x )
theta
input
None