Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase maximum depth for quick-select to 16 #8021

Merged
merged 8 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/controllers/DatasetController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ class DatasetController @Inject()(userService: UserService,
datastoreClient <- datasetService.clientFor(dataset)(GlobalAccessContext)
targetMagSelectedBbox: BoundingBox = request.body.surroundingBoundingBox / request.body.mag
_ <- bool2Fox(targetMagSelectedBbox.size.sorted.z <= 1024 && targetMagSelectedBbox.size.sorted.y <= 1024) ?~> s"Target-mag selected bbox must be smaller than 1024×1024×depth (or transposed), got ${targetMagSelectedBbox.size}"
_ <- bool2Fox(targetMagSelectedBbox.size.sorted.x <= 12) ?~> s"Target-mag selected bbox depth must be at most 12"
_ <- bool2Fox(targetMagSelectedBbox.size.sorted.x <= 16) ?~> s"Target-mag selected bbox depth must be at most 16"
philippotto marked this conversation as resolved.
Show resolved Hide resolved
_ <- bool2Fox(targetMagSelectedBbox.size.sorted.z == targetMagSelectedBbox.size.sorted.y) ?~> s"Target-mag selected bbox must equally sized long edges, got ${targetMagSelectedBbox.size}"
_ <- Fox.runIf(request.body.interactionType == SAMInteractionType.BOUNDING_BOX)(
bool2Fox(request.body.selectionTopLeftX.isDefined &&
Expand Down
13 changes: 9 additions & 4 deletions frontend/javascripts/oxalis/model/sagas/quick_select_ml_saga.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,17 +257,22 @@ export default function* performQuickSelect(
const userBoxRelativeToMaskInMag = userBoxInMag.offset(V3.negate(maskBoxInMag.min));

let wOffset = 0;
const currentEstimationInputForBBoxEstimation = {
min: userBoxRelativeToMaskInMag.getMinUV(activeViewport),
max: userBoxRelativeToMaskInMag.getMaxUV(activeViewport),
};
for (const mask of masks) {
const targetW = alignedUserBoxMag1.min[thirdDim] + labeledResolution[thirdDim] * wOffset;

const { min: minUV, max: maxUV } = estimateBBoxInMask(
mask,
{
min: userBoxRelativeToMaskInMag.getMinUV(activeViewport),
max: userBoxRelativeToMaskInMag.getMaxUV(activeViewport),
},
currentEstimationInputForBBoxEstimation,
MAXIMUM_PADDING_ERROR,
);
// Use the estimated bbox as input for the next iteration so that
// moving segments don't "exit" the used bbox at the some point in W.
currentEstimationInputForBBoxEstimation.min = minUV;
currentEstimationInputForBBoxEstimation.max = maxUV;

// Span a bbox from the estimated values (relative to the mask)
// and move it by the mask's min position to achieve a global
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import features from "features";
import FastTooltip from "components/fast_tooltip";
import { QuestionCircleOutlined } from "@ant-design/icons";

const MAX_DEPTH_FOR_SAM = 16;

const OPTIONS_WITH_DISABLED = [
{ label: "Dark Segment", value: "dark" },
{ label: "Light Segment", value: "light" },
Expand Down Expand Up @@ -73,7 +75,7 @@ export function AiQuickSelectControls() {
label="Prediction Depth"
min={1}
value={quickSelectConfig.predictionDepth || 1}
max={5}
max={MAX_DEPTH_FOR_SAM}
step={1}
onChange={onChangePredictionDepth}
/>
Expand Down