Implement U-Net's final 1 by 1 convolution as a per-pixel linear projection.
Yb,h,w,:=Xb,h,w,:Wout+boutHere, X has C feature channels, Wout has shape (C,K), and K is the number of segmentation classes. Do not apply an activation. Return raw logits as a float64 NumPy array with shape (B,H,W,K).
Examples
Input: features = [[[[1,-1],[0.5,2]]]], W_out = [[0.3,-0.2],[0.5,0.1]], b_out = [0.1,-0.1]
Output: [[[[-0.1,-0.4],[1.25,0]]]]
Explanation: The same channel-to-class projection is applied independently at each pixel.
Input: features = [[[[1],[2]],[[3],[4]]]], W_out = [[0.25]], b_out = [-0.5]
Output: [[[[-0.25],[0]],[[0.25],[0.5]]]]
Input: features = [[[[0,1,-1]]],[[[2,-0.5,1]]]], W_out = [[1,0],[0,1],[0.5,-0.5]], b_out = [0.2,0.3]
Output: [[[[-0.3,1.8]]],[[[2.7,-0.7]]]]
Hint 1
The final feature axis aligns with the first axis of W_out.
Hint 2
NumPy broadcasts b_out across batch and spatial axes.
Requirements
- Use NumPy.
- Apply the supplied channel projection independently at every pixel.
- Add the supplied class bias.
- Do not apply sigmoid or softmax.
- Return a float64 NumPy array.
Constraints
- features has shape (B, H, W, C) and dtype float64.
- W_out has shape (C, K) and dtype float64.
- b_out has shape (K) and dtype float64.
- All dimensions are positive.
All steps in U-Net
Accepts: array
Accepts: array
Accepts: array
U-Net Output Layer
Implement U-Net's final 1 by 1 convolution as a per-pixel linear projection.
Yb,h,w,:=Xb,h,w,:Wout+boutHere, X has C feature channels, Wout has shape (C,K), and K is the number of segmentation classes. Do not apply an activation. Return raw logits as a float64 NumPy array with shape (B,H,W,K).
Examples
Input: features = [[[[1,-1],[0.5,2]]]], W_out = [[0.3,-0.2],[0.5,0.1]], b_out = [0.1,-0.1]
Output: [[[[-0.1,-0.4],[1.25,0]]]]
Explanation: The same channel-to-class projection is applied independently at each pixel.
Input: features = [[[[1],[2]],[[3],[4]]]], W_out = [[0.25]], b_out = [-0.5]
Output: [[[[-0.25],[0]],[[0.25],[0.5]]]]
Input: features = [[[[0,1,-1]]],[[[2,-0.5,1]]]], W_out = [[1,0],[0,1],[0.5,-0.5]], b_out = [0.2,0.3]
Output: [[[[-0.3,1.8]]],[[[2.7,-0.7]]]]
Hint 1
The final feature axis aligns with the first axis of W_out.
Hint 2
NumPy broadcasts b_out across batch and spatial axes.
Requirements
- Use NumPy.
- Apply the supplied channel projection independently at every pixel.
- Add the supplied class bias.
- Do not apply sigmoid or softmax.
- Return a float64 NumPy array.
Constraints
- features has shape (B, H, W, C) and dtype float64.
- W_out has shape (C, K) and dtype float64.
- b_out has shape (K) and dtype float64.
- All dimensions are positive.
All steps in U-Net
Accepts: array
Accepts: array
Accepts: array