diff --git a/plugins/tensorboard-plugins/tb_plugin/fe/src/app.tsx b/plugins/tensorboard-plugins/tb_plugin/fe/src/app.tsx index 2acfe15907bb7fc20ee536fb40e598678f25c6f5..22888dbf0fa49d2550224a7b2c02ade93a4eafe0 100644 --- a/plugins/tensorboard-plugins/tb_plugin/fe/src/app.tsx +++ b/plugins/tensorboard-plugins/tb_plugin/fe/src/app.tsx @@ -210,6 +210,7 @@ export const App = () => { const [topTab, setTopTab] = React.useState(0) const [fileList, setFileList] = React.useState([]) + const [uploadedCount, setUploadedCount] = React.useState(0) // #endregion @@ -409,6 +410,10 @@ export const App = () => { } } + const _changeUploadCount = (count: number) => { + setUploadedCount(count) + } + // #endregion const renderContent = () => { @@ -644,7 +649,8 @@ export const App = () => { ) : } @@ -660,7 +666,7 @@ export const App = () => { )}
- {topTab === 0 ? renderContent() : } + {topTab === 0 ? renderContent() : }
) diff --git a/plugins/tensorboard-plugins/tb_plugin/fe/src/components/Accuracy/AccuracyLeftPanel.tsx b/plugins/tensorboard-plugins/tb_plugin/fe/src/components/Accuracy/AccuracyLeftPanel.tsx index 97eaa0fc7e6df5b881d4f95fa8fd9efcd03fb373..71682214de9357fb2a757ff7d84ac4a47cd471ab 100644 --- a/plugins/tensorboard-plugins/tb_plugin/fe/src/components/Accuracy/AccuracyLeftPanel.tsx +++ b/plugins/tensorboard-plugins/tb_plugin/fe/src/components/Accuracy/AccuracyLeftPanel.tsx @@ -33,7 +33,8 @@ import { RegexConfigModal } from './RegexConfigModal' import { FileInfo } from './entity' interface IProps { - onChangeFileList: (files: FileInfo[]) => void + onChangeCheckedFileList: (files: FileInfo[]) => void + onChangeUploadedCount: (count: number) => void } // 匹配数字包括科学计数法 @@ -108,7 +109,7 @@ const useStyles = makeStyles(() => ({ // 最大文件上传数量 export const MAX_FILE_COUNT = 6 export const AccuracyLeftPanel: React.FC = (props) => { - const { onChangeFileList } = props + const { onChangeCheckedFileList, onChangeUploadedCount } = props const classes = useStyles() const [configModalVis, setConfigModalVis] = useState(false) const [deleteModalVis, setDeleteModalVis] = useState(false) @@ -297,7 +298,8 @@ export const AccuracyLeftPanel: React.FC = (props) => { }, [JSON.stringify(fileList)]) useEffect(() => { - onChangeFileList(fileList) + onChangeCheckedFileList(fileList.filter(item => item.checked)) + onChangeUploadedCount(fileList.length) }, [JSON.stringify(fileList)]) return ( diff --git a/plugins/tensorboard-plugins/tb_plugin/fe/src/components/Accuracy/ComparisonPanel.tsx b/plugins/tensorboard-plugins/tb_plugin/fe/src/components/Accuracy/ComparisonPanel.tsx index 5b066eeb1e9be65ab9e8d1adb916c3cf90ae28a9..cb435bc1c9b474a15b5999087ead848980305fae 100644 --- a/plugins/tensorboard-plugins/tb_plugin/fe/src/components/Accuracy/ComparisonPanel.tsx +++ b/plugins/tensorboard-plugins/tb_plugin/fe/src/components/Accuracy/ComparisonPanel.tsx @@ -18,12 +18,13 @@ *--------------------------------------------------------------------------------------------*/ import * as React from 'react' -import { useState, useLayoutEffect, useRef } from 'react' +import { useState, useLayoutEffect, useRef, useEffect } from 'react' import { makeStyles } from '@material-ui/core/styles' import { FileInfo } from './entity' -import { Empty, Radio, RadioChangeEvent, Select, Table } from 'antd' +import { Empty, Popover, Radio, RadioChangeEvent, Select, Table } from 'antd' import { ColumnsType } from 'antd/es/table' import * as echarts from 'echarts' +import { InfoCircleOutlined } from '@ant-design/icons' interface IProps { fileList: FileInfo[] @@ -61,6 +62,9 @@ const useStyles = makeStyles(() => ({ }, '& .comparisonBtn': { marginLeft: 20 + }, + '& .infoLabel': { + fontSize: 20 } }, empty: { @@ -220,6 +224,13 @@ export const ComparisonPanel: React.FC = (props) => { } }, [compareWay, lineData]) + useEffect(() => { + const tempValue = selectedFiles.filter(item => { + return !!fileList.find(file => file.fileName === item) + }) + setSelectedFiles(tempValue) + }, [fileList]) + return (
Comparison Data
@@ -250,6 +261,17 @@ export const ComparisonPanel: React.FC = (props) => { Comparison Absolute Comparison Relative + +
Normal: The real difference.
+
Absolute: The absolute value of difference.
+
Relative: The absolute value of difference divided by the loss value of the first file.
+ + } + > + +
{selectedFiles.length < 2 ? diff --git a/plugins/tensorboard-plugins/tb_plugin/fe/src/components/Accuracy/LossComparison.tsx b/plugins/tensorboard-plugins/tb_plugin/fe/src/components/Accuracy/LossComparison.tsx index 23a669685d9924482a3be39767a0d982da38c7a1..e6df761f8de43c8219cc19841d7cd9511ea311b0 100644 --- a/plugins/tensorboard-plugins/tb_plugin/fe/src/components/Accuracy/LossComparison.tsx +++ b/plugins/tensorboard-plugins/tb_plugin/fe/src/components/Accuracy/LossComparison.tsx @@ -27,6 +27,7 @@ import { MAX_FILE_COUNT } from './AccuracyLeftPanel' interface IProps { fileList: FileInfo[] + fileCount: number } const useStyles = makeStyles(() => ({ @@ -54,12 +55,11 @@ const useStyles = makeStyles(() => ({ })) export const LossComparison: React.FC = (props) => { - const { fileList } = props + const { fileList, fileCount } = props const classes = useStyles() - const checkedFiles = fileList.filter(item => item.checked) const onImportFile = () => { - if (fileList.length >= MAX_FILE_COUNT) { + if (fileCount >= MAX_FILE_COUNT) { message.warn(`You can import no more than ${MAX_FILE_COUNT} files.`) return } @@ -68,7 +68,7 @@ export const LossComparison: React.FC = (props) => { return (
- {checkedFiles.length <= 0 ? + {fileList.length <= 0 ? <> Welcome to loss comparison
Select left files or Import files
@@ -76,9 +76,9 @@ export const LossComparison: React.FC = (props) => { : <> - - {checkedFiles.length > 1 && - + + {fileList.length > 1 && + } }