From 5d08056784bc3cb99724e1b24f9c05179c2ac790 Mon Sep 17 00:00:00 2001 From: gary-Shen Date: Tue, 19 Nov 2024 16:07:07 +0800 Subject: [PATCH 1/4] fix(audio-react): fix active annotation while switching from a different type annotation --- packages/audio-react/src/Audio.tsx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/audio-react/src/Audio.tsx b/packages/audio-react/src/Audio.tsx index 62ffb1b6c..f0cf6f767 100644 --- a/packages/audio-react/src/Audio.tsx +++ b/packages/audio-react/src/Audio.tsx @@ -113,6 +113,7 @@ export const AudioAnnotator = forwardRef(fu ref, ) { const playerRef = useRef(null); + const editTypeRef = useRef(editingType); const annotatorRef = useRef(null); const [duration, setDuration] = useState(0); const controllerRef = useRef(null); @@ -293,12 +294,15 @@ export const AudioAnnotator = forwardRef(fu useImperativeHandle(propsAnnotatorRef, () => annotatorRef.current!, [annotatorRef, duration]); useEffect(() => { - setSelectedAnnotation(propsSelectedAnnotation); - }, [propsSelectedAnnotation]); + if (editTypeRef.current !== editingType) { + editTypeRef.current = editingType; + setSelectedAnnotation(undefined); + } + }, [editingType]); useEffect(() => { - setSelectedAnnotation(undefined); - }, [editingType]); + setSelectedAnnotation(propsSelectedAnnotation); + }, [propsSelectedAnnotation]); // 选中时间点后,更新在时间区间内的标注 useEffect(() => { From ee4d14aa47cd396f397d046ffcc9dd6e96c0c88c Mon Sep 17 00:00:00 2001 From: gary-Shen Date: Tue, 19 Nov 2024 16:07:31 +0800 Subject: [PATCH 2/4] fix(video-react): fix active annotation while switching from a different type annotation --- packages/video-react/src/Video.tsx | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/packages/video-react/src/Video.tsx b/packages/video-react/src/Video.tsx index 9d27bea17..5582e362c 100644 --- a/packages/video-react/src/Video.tsx +++ b/packages/video-react/src/Video.tsx @@ -57,19 +57,25 @@ const VideoAnnotator = forwardRef(function Fo ref, ) { const [duration, setDuration] = useState(0); - const [selectedAnnotation, setSelectedAnnotation] = useState(); + const [selectedAnnotation, setSelectedAnnotation] = useState( + propsSelectedAnnotation, + ); + const editTypeRef = useRef(editingType); const playerRef = useRef(null); const annotatorRef = useRef(null); const isPlayingRef = useRef(false); const [playingAnnotationIds, setPlayingAnnotationIds] = useState([]); useEffect(() => { - setSelectedAnnotation(propsSelectedAnnotation); - }, [propsSelectedAnnotation]); + if (editTypeRef.current !== editingType) { + editTypeRef.current = editingType; + setSelectedAnnotation(undefined); + } + }, [editingType]); useEffect(() => { - setSelectedAnnotation(undefined); - }, [editingType]); + setSelectedAnnotation(propsSelectedAnnotation); + }, [propsSelectedAnnotation]); useEffect(() => { if (playerRef.current) { From 4b354480fe98290ea450e2ca98a60451f7782a50 Mon Sep 17 00:00:00 2001 From: gary-Shen Date: Tue, 19 Nov 2024 16:11:22 +0800 Subject: [PATCH 3/4] fix(frontend): update doc links --- apps/frontend/src/components/Navigate/index.tsx | 4 ++-- .../src/pages/tasks.[id].edit/partials/InputData/index.tsx | 2 +- apps/frontend/src/pages/tasks.[id]/index.tsx | 2 +- apps/frontend/src/pages/tasks/index.tsx | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/frontend/src/components/Navigate/index.tsx b/apps/frontend/src/components/Navigate/index.tsx index c72c96c65..fc51e439a 100644 --- a/apps/frontend/src/components/Navigate/index.tsx +++ b/apps/frontend/src/components/Navigate/index.tsx @@ -62,7 +62,7 @@ const Homepage = () => { {window.IS_ONLINE && ( - + @@ -72,7 +72,7 @@ const Homepage = () => { type="link" data-wiz="documentation" icon={} - href="https://opendatalab.github.io/labelU/#/" + href="https://opendatalab.github.io/labelU/guide/introduction" style={{ color: 'rgba(0, 0, 0, 0.85)' }} target="_blank" rel="noreferrer" diff --git a/apps/frontend/src/pages/tasks.[id].edit/partials/InputData/index.tsx b/apps/frontend/src/pages/tasks.[id].edit/partials/InputData/index.tsx index d13e9c103..3471d0037 100644 --- a/apps/frontend/src/pages/tasks.[id].edit/partials/InputData/index.tsx +++ b/apps/frontend/src/pages/tasks.[id].edit/partials/InputData/index.tsx @@ -431,7 +431,7 @@ const InputData = () => { 支持上传 jsonl 格式的预标注文件或LabelU 导出 json 标注文件,参考{' '} 示例 diff --git a/apps/frontend/src/pages/tasks.[id]/index.tsx b/apps/frontend/src/pages/tasks.[id]/index.tsx index 71cda1cac..fb8f60d69 100644 --- a/apps/frontend/src/pages/tasks.[id]/index.tsx +++ b/apps/frontend/src/pages/tasks.[id]/index.tsx @@ -127,7 +127,7 @@ const Samples = () => { <> 数据导入时上传 labelu 导出的 json标注文件或组装成 jsonl 文件 即可导入预标注,预标注格式参考{' '} diff --git a/apps/frontend/src/pages/tasks/index.tsx b/apps/frontend/src/pages/tasks/index.tsx index 586eb2cb7..cc1ae2d1e 100644 --- a/apps/frontend/src/pages/tasks/index.tsx +++ b/apps/frontend/src/pages/tasks/index.tsx @@ -88,7 +88,7 @@ const TaskList = () => { 当前为体验版,每日凌晨数据将自动清空,请及时备份重要数据。如需完整使用,建议 From 4d53b75980e3957e9a33948967ac46a3536075cc Mon Sep 17 00:00:00 2001 From: gary-Shen Date: Tue, 19 Nov 2024 16:19:43 +0800 Subject: [PATCH 4/4] fix(frontend): update video and audio pre-annotation file json schema --- .../partials/InputData/audioPreAnnotationJson.schema.json | 4 ++-- .../src/pages/tasks.[id].edit/partials/InputData/index.tsx | 6 ++++-- .../partials/InputData/videoPreAnnotationJson.schema.json | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/apps/frontend/src/pages/tasks.[id].edit/partials/InputData/audioPreAnnotationJson.schema.json b/apps/frontend/src/pages/tasks.[id].edit/partials/InputData/audioPreAnnotationJson.schema.json index e9dbb1772..7d933103e 100644 --- a/apps/frontend/src/pages/tasks.[id].edit/partials/InputData/audioPreAnnotationJson.schema.json +++ b/apps/frontend/src/pages/tasks.[id].edit/partials/InputData/audioPreAnnotationJson.schema.json @@ -151,7 +151,7 @@ "properties": { "toolName": { "type": "string", - "const": "frameTool" + "const": "audioFrameTool" }, "result": { "type": "array", @@ -190,7 +190,7 @@ "properties": { "toolName": { "type": "string", - "const": "segmentTool" + "const": "audioSegmentTool" }, "result": { "type": "array", diff --git a/apps/frontend/src/pages/tasks.[id].edit/partials/InputData/index.tsx b/apps/frontend/src/pages/tasks.[id].edit/partials/InputData/index.tsx index 3471d0037..c5b68893a 100644 --- a/apps/frontend/src/pages/tasks.[id].edit/partials/InputData/index.tsx +++ b/apps/frontend/src/pages/tasks.[id].edit/partials/InputData/index.tsx @@ -27,6 +27,8 @@ import { TaskCreationContext } from '../../taskCreation.context'; import { Bar, ButtonWrapper, Header, Left, Right, Spot, UploadArea, Wrapper } from './style'; import imageSchema from './imagePreAnnotationJsonl.schema.json'; import imageJsonSchema from './imagePreAnnotationJson.schema.json'; +import audioJsonSchema from './audioPreAnnotationJson.schema.json'; +import videoJsonSchema from './videoPreAnnotationJson.schema.json'; import audioSchema from './audioPreAnnotationJsonl.schema.json'; import videoSchema from './videoPreAnnotationJsonl.schema.json'; import { isCorrectFiles, isPreAnnotationFile, normalizeFiles, readFile, UploadStatus } from './utils'; @@ -47,8 +49,8 @@ const jsonlMapping = { const jsonMapping = { [MediaType.IMAGE]: imageJsonSchema, - [MediaType.VIDEO]: videoSchema, - [MediaType.AUDIO]: audioSchema, + [MediaType.VIDEO]: videoJsonSchema, + [MediaType.AUDIO]: audioJsonSchema, }; export interface QueuedFile { diff --git a/apps/frontend/src/pages/tasks.[id].edit/partials/InputData/videoPreAnnotationJson.schema.json b/apps/frontend/src/pages/tasks.[id].edit/partials/InputData/videoPreAnnotationJson.schema.json index e9dbb1772..2126fecff 100644 --- a/apps/frontend/src/pages/tasks.[id].edit/partials/InputData/videoPreAnnotationJson.schema.json +++ b/apps/frontend/src/pages/tasks.[id].edit/partials/InputData/videoPreAnnotationJson.schema.json @@ -151,7 +151,7 @@ "properties": { "toolName": { "type": "string", - "const": "frameTool" + "const": "videoFrameTool" }, "result": { "type": "array", @@ -190,7 +190,7 @@ "properties": { "toolName": { "type": "string", - "const": "segmentTool" + "const": "videoSegmentTool" }, "result": { "type": "array",