Skip to content

Commit

Permalink
Merge pull request #5190 from voxel51/merge/release/v1.1.0
Browse files Browse the repository at this point in the history
Merge `release/v1.1.0` to `develop`
  • Loading branch information
benjaminpkane authored Dec 2, 2024
2 parents 48c52c4 + a16fb12 commit a6b5481
Show file tree
Hide file tree
Showing 29 changed files with 429 additions and 165 deletions.
4 changes: 2 additions & 2 deletions app/packages/app/src/components/Nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
GitHubLink,
Header,
IconButton,
SlackLink,
DiscordLink,
iconContainer,
} from "@fiftyone/components";
import { ViewBar } from "@fiftyone/core";
Expand Down Expand Up @@ -111,7 +111,7 @@ const Nav: React.FC<
>
{mode === "dark" ? <LightMode color="inherit" /> : <DarkMode />}
</IconButton>
<SlackLink />
<DiscordLink />
<GitHubLink />
<DocsLink />
</div>
Expand Down
4 changes: 2 additions & 2 deletions app/packages/app/src/components/Setup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
DocsLink,
GitHubLink,
Header,
SlackLink,
DiscordLink,
iconContainer,
useTheme,
} from "@fiftyone/components";
Expand Down Expand Up @@ -190,7 +190,7 @@ const Setup = () => {
<div data-cy="setup-page">
<Header title={"FiftyOne"}>
<div className={iconContainer} style={{ flex: 1 }}>
<SlackLink />
<DiscordLink />
<GitHubLink />
<DocsLink />
</div>
Expand Down
9 changes: 5 additions & 4 deletions app/packages/components/src/components/Icons/Icons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,19 @@ import { iconLink } from "./Icons.module.css";

export { iconContainer } from "./Icons.module.css";

export const SlackLink = () => (
export const DiscordLink = () => (
<ExternalLink
className={iconLink}
href={"https://slack.voxel51.com"}
title={"Slack"}
href={"https://community.voxel51.com/"}
title={"Discord"}
>
<SvgIcon
sx={{
fill: (theme) => theme.palette.text.secondary,
}}
viewBox="0 0 127.14 96.36"
>
<path d="M6 15a2 2 0 0 1-2 2a2 2 0 0 1-2-2a2 2 0 0 1 2-2h2v2m1 0a2 2 0 0 1 2-2a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2a2 2 0 0 1-2-2v-5m2-8a2 2 0 0 1-2-2a2 2 0 0 1 2-2a2 2 0 0 1 2 2v2H9m0 1a2 2 0 0 1 2 2a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2a2 2 0 0 1 2-2h5m8 2a2 2 0 0 1 2-2a2 2 0 0 1 2 2a2 2 0 0 1-2 2h-2v-2m-1 0a2 2 0 0 1-2 2a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2a2 2 0 0 1 2 2v5m-2 8a2 2 0 0 1 2 2a2 2 0 0 1-2 2a2 2 0 0 1-2-2v-2h2m0-1a2 2 0 0 1-2-2a2 2 0 0 1 2-2h5a2 2 0 0 1 2 2a2 2 0 0 1-2 2h-5z" />
<path d="M107.7,8.07A105.15,105.15,0,0,0,81.47,0a72.06,72.06,0,0,0-3.36,6.83A97.68,97.68,0,0,0,49,6.83,72.37,72.37,0,0,0,45.64,0,105.89,105.89,0,0,0,19.39,8.09C2.79,32.65-1.71,56.6.54,80.21h0A105.73,105.73,0,0,0,32.71,96.36,77.7,77.7,0,0,0,39.6,85.25a68.42,68.42,0,0,1-10.85-5.18c.91-.66,1.8-1.34,2.66-2a75.57,75.57,0,0,0,64.32,0c.87.71,1.76,1.39,2.66,2a68.68,68.68,0,0,1-10.87,5.19,77,77,0,0,0,6.89,11.1A105.25,105.25,0,0,0,126.6,80.22h0C129.24,52.84,122.09,29.11,107.7,8.07ZM42.45,65.69C36.18,65.69,31,60,31,53s5-12.74,11.43-12.74S54,46,53.89,53,48.84,65.69,42.45,65.69Zm42.24,0C78.41,65.69,73.25,60,73.25,53s5-12.74,11.44-12.74S96.23,46,96.12,53,91.08,65.69,84.69,65.69Z" />
</SvgIcon>
</ExternalLink>
);
Expand Down
2 changes: 1 addition & 1 deletion app/packages/components/src/components/Icons/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ export {
KeyboardArrowUp,
LookerArrowLeftIcon,
LookerArrowRightIcon,
SlackLink,
DiscordLink,
} from "./Icons";
44 changes: 30 additions & 14 deletions app/packages/core/src/plugins/SchemaIO/components/ActionsMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,13 @@ function Action(props: ActionPropsType) {
const { label, name, onClick, icon, variant, mode, color, size, tooltip } =
props;
const resolvedColor = color ? getColorByCode(color) : undefined;

const Icon = icon ? (
<MuiIconFont name={icon} sx={{ color: resolvedColor }} />
<MuiIconFont
name={icon}
sx={{
color: resolvedColor,
}}
/>
) : null;

const handleClick = useCallback(
Expand All @@ -91,18 +95,30 @@ function Action(props: ActionPropsType) {

const content =
mode === "inline" ? (
<Button
variant={variant}
startIcon={Icon}
onClick={handleClick}
sx={{
color: resolvedColor,
padding: size === "small" ? 0 : undefined,
minWidth: size === "small" ? 40 : undefined,
}}
>
{label}
</Button>
label ? (
<Button
variant={variant}
startIcon={Icon}
onClick={handleClick}
sx={{
color: resolvedColor,
padding: size === "small" ? 0 : undefined,
minWidth: size === "small" ? 40 : undefined,
}}
>
{label}
</Button>
) : (
<IconButton
onClick={handleClick}
size={size}
sx={{
color: resolvedColor,
}}
>
{Icon}
</IconButton>
)
) : (
<MenuItem onClick={handleClick}>
{Icon && <ListItemIcon>{Icon}</ListItemIcon>}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1155,12 +1155,28 @@ export default function Evaluation(props: EvaluationProps) {
colorscale: confusionMatrixConfig.log
? confusionMatrix?.colorscale || "viridis"
: "viridis",
hovertemplate:
[
"<b>count: %{z:d}</b>",
`${
evaluation?.info?.config?.gt_field || "truth"
}: %{y}`,
`${
evaluation?.info?.config?.pred_field ||
"predicted"
}: %{x}`,
].join(" <br>") + "<extra></extra>",
},
]}
onClick={({ points }) => {
const firstPoint = points[0];
loadView("matrix", { x: firstPoint.x, y: firstPoint.y });
}}
layout={{
yaxis: {
autorange: "reversed",
},
}}
/>
</Stack>
{compareKey && (
Expand All @@ -1183,8 +1199,24 @@ export default function Evaluation(props: EvaluationProps) {
colorscale: confusionMatrixConfig.log
? compareConfusionMatrix?.colorscale || "viridis"
: "viridis",
hovertemplate:
[
"<b>count: %{z:d}</b>",
`${
evaluation?.info?.config?.gt_field || "truth"
}: %{y}`,
`${
evaluation?.info?.config?.pred_field ||
"predicted"
}: %{x}`,
].join(" <br>") + "<extra></extra>",
},
]}
layout={{
yaxis: {
autorange: "reversed",
},
}}
/>
</Stack>
)}
Expand Down Expand Up @@ -1532,8 +1564,8 @@ function getMatrix(matrices, config) {
if (!matrices) return;
const { sortBy = "az", limit } = config;
const parsedLimit = typeof limit === "number" ? limit : undefined;
const classes = matrices[`${sortBy}_classes`].slice(parsedLimit);
const matrix = matrices[`${sortBy}_matrix`].slice(parsedLimit);
const classes = matrices[`${sortBy}_classes`].slice(0, parsedLimit);
const matrix = matrices[`${sortBy}_matrix`].slice(0, parsedLimit);
const colorscale = matrices[`${sortBy}_colorscale`];
return { labels: classes, matrix, colorscale };
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useTheme } from "@fiftyone/components";
import { merge } from "lodash";
import React, { useMemo } from "react";
import Plot, { PlotParams } from "react-plotly.js";

Expand Down Expand Up @@ -31,7 +32,6 @@ export default function EvaluationPlot(props: EvaluationPlotProps) {
color: theme.text.secondary,
gridcolor: theme.primary.softBorder,
automargin: true, // Enable automatic margin adjustment
scaleanchor: "x",
},
autosize: true,
margin: { t: 20, l: 50, b: 50, r: 20, pad: 0 },
Expand All @@ -45,6 +45,11 @@ export default function EvaluationPlot(props: EvaluationPlotProps) {
},
};
}, [theme]);

const mergedLayout = useMemo(() => {
return merge({}, layoutDefaults, layout);
}, [layoutDefaults, layout]);

const configDefaults: PlotConfig = useMemo(() => {
return {
displaylogo: false,
Expand All @@ -66,7 +71,7 @@ export default function EvaluationPlot(props: EvaluationPlotProps) {
return (
<Plot
config={configDefaults}
layout={{ ...layoutDefaults, ...layout }}
layout={mergedLayout}
style={{ height: "100%", width: "100%", zIndex: 1, ...style }}
data={data}
{...otherProps}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,12 +222,14 @@ export default function TableView(props: ViewPropsType) {
: "unset",
}}
>
{currentRowHasActions && (
{currentRowHasActions ? (
<ActionsMenu
actions={getRowActions(rowIndex)}
size={size}
maxInline={max_inline_actions}
/>
) : (
<Box sx={{ minHeight: "32px" }} />
)}
</TableCell>
)}
Expand Down
6 changes: 5 additions & 1 deletion app/packages/looker-3d/src/labels/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,11 @@ export const ThreeDLabels = ({ sampleMap }: ThreeDLabelsProps) => {
const newPolylineOverlays = [];

for (const overlay of rawOverlays) {
if (overlay._cls === "Detection") {
if (
overlay._cls === "Detection" &&
overlay.dimensions &&
overlay.location
) {
newCuboidOverlays.push(
<Cuboid
key={`cuboid-${overlay.id ?? overlay._id}-${overlay.sampleId}`}
Expand Down
2 changes: 1 addition & 1 deletion app/packages/looker/src/overlays/detection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export default class DetectionOverlay<
this.label.mask && this.drawMask(ctx, state);
!state.config.thumbnail && this.drawLabelText(ctx, state);

if (this.is3D) {
if (this.is3D && this.label.dimensions && this.label.location) {
this.fillRectFor3d(ctx, state, this.getColor(state));
} else {
this.strokeRect(ctx, state, this.getColor(state));
Expand Down
6 changes: 5 additions & 1 deletion app/packages/looker/src/worker/threed-label-processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ const getInferredParamsForUndefinedProjection = (

if (cls === DETECTIONS) {
for (const detection of label.detections as DetectionLabel[]) {
if (!detection.location || !detection.dimensions) {
continue;
}

const [x, y] = detection.location;
const [lx, ly] = detection.dimensions;

Expand All @@ -55,7 +59,7 @@ const getInferredParamsForUndefinedProjection = (
minY = Math.min(minY, y - ly / 2);
maxY = Math.max(maxY, y + ly / 2);
}
} else if (cls === "Detection") {
} else if (cls === "Detection" && label.location && label.dimensions) {
const [x, y] = label.location as DetectionLabel["location"];
const [lx, ly] = label.dimensions as DetectionLabel["dimensions"];

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions docs/source/_templates/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<div class="nav__item nav__dropdown__menu has-arrows">
<div class="arrow-up--light-primary arrow-left20"></div>
<ul>
<li><a href="{{link_voxel51_slack}}">Community Slack</a></li>
<li><a href="{{link_voxel51_discord}}">Community Discord</a></li>
<li><a href="{{link_voxel51_blog}}">Blog</a></li>
<li><a href="{{link_events}}">Events</a></li>
</ul>
Expand Down Expand Up @@ -140,7 +140,7 @@
<a href="{{link_voxel51_blog}}">Blog</a>
<a href="{{link_docs_fiftyone}}">Docs</a>
<a href="{{link_voxel51_github}}">GitHub</a>
<a href="{{link_voxel51_slack}}">Slack</a>
<a href="{{link_voxel51_discord}}">Discord</a>
<a href="{{link_ourstory}}">About Us</a>
<a href="{{link_events}}">Events</a>
<a href="{{link_voxel51_jobs}}">Careers</a>
Expand Down
Loading

0 comments on commit a6b5481

Please sign in to comment.