ravens/models/transport_goal.py
def visualize_logits(self, logits, name):
        """Given logits (BEFORE tf.nn.convolution), get a heatmap.

        Here we apply a softmax to make it more human-readable. However, the
        tf.nn.convolution with the learned kernels happens without a softmax
        on the logits. [Update: wait, then why should we have a softmax,
        then? I forgot why we did this ...]
        """
        original_shape = logits.shape
        logits = tf.reshape(logits, (1, np.prod(original_shape)))
        # logits = tf.nn.softmax(logits)  # Is this necessary?
        vis_transport = np.float32(logits).reshape(original_shape)
        vis_transport = vis_transport[0]
        vis_transport = vis_transport - np.min(vis_transport)
        vis_transport = 255 * vis_transport / np.max(vis_transport)
        vis_transport = cv2.applyColorMap(np.uint8(vis_transport), cv2.COLORMAP_RAINBOW)

        # Only if we're saving with cv2.imwrite()
        vis_transport = cv2.cvtColor(vis_transport, cv2.COLOR_RGB2BGR)
        cv2.imwrite(f'tmp/logits_{name}.png', vis_transport)

        plt.subplot(1, 1, 1)
        plt.title(f'Logits: {name}', fontsize=15)
        plt.imshow(vis_transport)
        plt.tight_layout()
        plt.show()
Given logits (BEFORE tf.nn.convolution), get a heatmap.

        Here we apply a softmax to make it more human-readable. However, the
        tf.nn.convolution with the learned kernels happens without a softmax
        on the logits. [Update: wait, then why should we have a softmax,
        then? I forgot why we did this ...]
        
Given logits (BEFORE tf.nn.convolution), get a heatmap.
Here we apply a softmax to make it more human-readable. However, the
tf.nn.convolution with the learned kernels happens without a softmax
on the logits. [Update: wait, then why should we have a softmax,
then. I forgot why we did this ...]
Given logits ( BEFORE tf . nn . convolution ) get a heatmap . Here we apply a softmax to make it more human - readable . However the tf . nn . convolution with the learned kernels happens without a softmax on the logits . [ Update : wait then why should we have a softmax then . I forgot why we did this ... ]
def visualize_logits(self, logits, name):
        original_shape = logits.shape
        logits = tf.reshape(logits, (1, np.prod(original_shape)))
        vis_transport = np.float32(logits).reshape(original_shape)
        vis_transport = vis_transport[0]
        vis_transport = vis_transport - np.min(vis_transport)
        vis_transport = 255 * vis_transport / np.max(vis_transport)
        vis_transport = cv2.applyColorMap(np.uint8(vis_transport), cv2.COLORMAP_RAINBOW)
        vis_transport = cv2.cvtColor(vis_transport, cv2.COLOR_RGB2BGR)
        cv2.imwrite(f'tmp/logits_{name}.png', vis_transport)
        plt.subplot(1, 1, 1)
        plt.title(f'Logits: {name}', fontsize=15)
        plt.imshow(vis_transport)
        plt.tight_layout()
        plt.show()
def visualize_logits ( self , logits , name ) : original_shape = logits . shape logits = tf . reshape ( logits , ( 1 , np . prod ( original_shape ) ) ) vis_transport = np . float32 ( logits ) . reshape ( original_shape ) vis_transport = vis_transport [ 0 ] vis_transport = vis_transport - np . min ( vis_transport ) vis_transport = 255 * vis_transport / np . max ( vis_transport ) vis_transport = cv2 . applyColorMap ( np . uint8 ( vis_transport ) , cv2 . COLORMAP_RAINBOW ) vis_transport = cv2 . cvtColor ( vis_transport , cv2 . COLOR_RGB2BGR ) cv2 . imwrite ( f'tmp/logits_{name}.png' , vis_transport ) plt . subplot ( 1 , 1 , 1 ) plt . title ( f'Logits: {name}' , fontsize = 15 ) plt . imshow ( vis_transport ) plt . tight_layout ( ) plt . show ( )
Given logits (BEFORE tf.nn.convolution), get a heatmap.
Given logits ( BEFORE tf . nn . convolution ) get a heatmap .
"""Given logits (BEFORE tf.nn.convolution), get a heatmap.

        Here we apply a softmax to make it more human-readable. However, the
        tf.nn.convolution with the learned kernels happens without a softmax
        on the logits. [Update: wait, then why should we have a softmax,
        then? I forgot why we did this ...]
        """ # logits = tf.nn.softmax(logits)  # Is this necessary? # Only if we're saving with cv2.imwrite()
self
logits
name