Commit f2b3b3b5 authored by Andrey Filippov's avatar Andrey Filippov

CLAUDE: Add velocity-count getters + DNN offset-channel overload

CuasRTUtils.getNumVout()/getSubDim() expose the 5D render dimensions for the
full-velocity-hyperstack memory estimate. CuasDnnInfer adds an inferROI(...,
double[][] offOut) overload that also returns the two offset channels
{dx, dy, s} per pixel (the DNN's per-pixel sub-pixel position estimate); the
existing 6-arg call delegates with offOut=null, so the field output is
unchanged. Both are prerequisites used by the CUAS-RT overhaul that follows.
Co-authored-by: 's avatarClaude Opus 4.8 (1M context) <noreply@anthropic.com>
parent bf2ba914
...@@ -69,6 +69,12 @@ public class CuasDnnInfer implements AutoCloseable { ...@@ -69,6 +69,12 @@ public class CuasDnnInfer implements AutoCloseable {
* returns the C5P-shaped field [roi_npix][1][vdim*vdim] = softmax(vel)*s (confidence-gated * returns the C5P-shaped field [roi_npix][1][vdim*vdim] = softmax(vel)*s (confidence-gated
* velocity posterior per pixel) - plugs straight into showConvKernel5d / the recurrent layer. */ * velocity posterior per pixel) - plugs straight into showConvKernel5d / the recurrent layer. */
public double[][][] inferROI(float[][] frames, int width, int height, Rectangle roi, int velRadius, double sThresh) throws Exception { public double[][][] inferROI(float[][] frames, int width, int height, Rectangle roi, int velRadius, double sThresh) throws Exception {
return inferROI(frames, width, height, roi, velRadius, sThresh, null);
}
/** As inferROI, but if offOut != null also fills offOut[roi_pix] = {dx, dy, s} from the two // By Claude on 06/14/2026
* offset channels (op[1+nvel], op[1+nvel+1]) - the DNN's per-pixel sub-pixel position estimate. */
public double[][][] inferROI(float[][] frames, int width, int height, Rectangle roi, int velRadius, double sThresh, double[][] offOut) throws Exception {
final int N = frames.length; final int N = frames.length;
final int P = 24, half = P / 2; // receptive field == training patch final int P = 24, half = P / 2; // receptive field == training patch
final int vdim = 2 * velRadius + 1, nvel = vdim * vdim; final int vdim = 2 * velRadius + 1, nvel = vdim * vdim;
...@@ -100,6 +106,7 @@ public class CuasDnnInfer implements AutoCloseable { ...@@ -100,6 +106,7 @@ public class CuasDnnInfer implements AutoCloseable {
for (int q = 0; q < bs; q++) { for (int q = 0; q < bs; q++) {
float[][][] op = out[q]; float[][][] op = out[q];
float s = sigmoid(op[0][0][0]); float s = sigmoid(op[0][0][0]);
if (offOut != null) offOut[base + q] = new double[] {op[1 + nvel][0][0], op[1 + nvel + 1][0][0], s}; // {dx,dy,s} for all pixels // By Claude on 06/14/2026
if (s < sThresh) continue; // below confidence -> leave field 0 // By Claude on 06/13/2026 if (s < sThresh) continue; // below confidence -> leave field 0 // By Claude on 06/13/2026
double mx = Double.NEGATIVE_INFINITY; double mx = Double.NEGATIVE_INFINITY;
for (int v = 0; v < nvel; v++) mx = Math.max(mx, op[1 + v][0][0]); for (int v = 0; v < nvel; v++) mx = Math.max(mx, op[1 + v][0][0]);
......
...@@ -185,6 +185,10 @@ public class CuasRTUtils { ...@@ -185,6 +185,10 @@ public class CuasRTUtils {
return kernel5d.length; return kernel5d.length;
} }
/** Number of output velocities (vout) and sub-pixel tiling of the 5D render - for memory estimates. // By Claude on 06/14/2026 */
public int getNumVout() { return kernel5d[0].length; }
public int getSubDim() { return (int) Math.sqrt(kernel5d[0][0].length); }
/** Temporal taps (frames) of the direct pixel-domain fine-velocity kernel. */ /** Temporal taps (frames) of the direct pixel-domain fine-velocity kernel. */
public int getNumHistDirect() { // By Claude on 06/11/2026 public int getNumHistDirect() { // By Claude on 06/11/2026
return consolidationKernelDirect.getKernel().length; return consolidationKernelDirect.getKernel().length;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment