Skip to content

rename image classification to object detection #197

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

Merged
merged 1 commit into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all 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 client/src/Annotation/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export default () => {
const { toggleTheme, theme } = useTheme();
const [settings, setSettings] = useState({
taskDescription: "",
taskChoice: "image_classification",
taskChoice: "object_detection",
images: [],
showLab: false,
mode: theme,
Expand Down
12 changes: 6 additions & 6 deletions client/src/ConfigurationTask/ConfigurationTask.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ jest.mock("react-i18next", () => ({
({
"setup.tabs.taskinfo.task_info": "Task Information",
"setup.tabs.taskinfo.task_choice": "Choice of Task",
"setup.tabs.taskinfo.task_choice_classification":
"Image Classification",
"setup.tabs.taskinfo.task_choice_object_detection":
"Object Detection",
"setup.tabs.taskinfo.task_choice_segmentation": "Image Segmentation",
})[key],
}),
Expand Down Expand Up @@ -61,7 +61,7 @@ describe("ConfigurationTask", () => {
title: "Task Choice",
type: "radiogroup",
choices: [
{ value: "image_classification", text: "Image Classification" },
{ value: "object_detection", text: "Object Detection" },
{ value: "image_segmentation", text: "Image Segmentation" },
],
},
Expand All @@ -81,13 +81,13 @@ describe("ConfigurationTask", () => {
expect(screen.getByText("Choice of Task")).toBeInTheDocument()

// Assert radio buttons are rendered
const imageClassificationRadio = screen.getByTestId(
`radio-taskChoice-image_classification`,
const imageObjectDetectionRadio = screen.getByTestId(
`radio-taskChoice-object_detection`,
)
const imageSegmentationRadio = screen.getByTestId(
`radio-taskChoice-image_segmentation`,
)
expect(imageClassificationRadio).toBeInTheDocument()
expect(imageObjectDetectionRadio).toBeInTheDocument()
expect(imageSegmentationRadio).toBeInTheDocument()

// Simulate changing radio button and verify onChange is called
Expand Down
6 changes: 3 additions & 3 deletions client/src/ConfigurationTask/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ export default ({ config, onChange }) => {
isRequired: true,
choices: [
{
value: "image_classification",
text: t("setup.tabs.taskinfo.task_choice_classification"),
value: "object_detection",
text: t("setup.tabs.taskinfo.task_choice_object_detection"),
},
{
value: "image_segmentation",
Expand All @@ -42,7 +42,7 @@ export default ({ config, onChange }) => {
taskChoice:
config.taskChoice !== undefined
? config.taskChoice
: "image_classification",
: "object_detection",
},
{ deep: true },
),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react"
import { render, screen, fireEvent } from "@testing-library/react"
import ConfigureImageClassification from "./index"
import ConfigureObjectDetection from "./index"
import "@testing-library/jest-dom"

// Mock the useTranslation hook with actual translations
Expand Down Expand Up @@ -73,13 +73,13 @@ jest.mock("material-survey/components/Survey", () => ({
)),
}))

describe("ConfigureImageClassification", () => {
describe("ConfigureObjectDetection", () => {
test("renders form with questions and calls onChange on answer change", () => {
const mockConfig = {}
const mockOnChange = jest.fn()

render(
<ConfigureImageClassification
<ConfigureObjectDetection
config={mockConfig}
onChange={mockOnChange}
/>,
Expand Down
4 changes: 2 additions & 2 deletions client/src/Localization/translation-de-DE.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const translationDeDE = {
"setup.tabs.images": "Bilder",
"setup.tabs.taskinfo.task_info": "Aufgabeninformation",
"setup.tabs.taskinfo.task_choice": "Aufgabenwahl",
"setup.tabs.taskinfo.task_choice_classification": "Bildklassifikation",
"setup.tabs.taskinfo.task_choice_object_detection": "Bildklassifikation",
"setup.tabs.taskinfo.task_choice_segmentation": "Bildsegmentierung",
"configuration.multiple_regions": "Können mehrere Regionen erstellt werden?",
"configuration.multiple_region_labels": "Mehrere Regionslabels erlaubt?",
Expand Down Expand Up @@ -70,7 +70,7 @@ const translationDeDE = {
helptext_circle: "Kreis hinzufügen",
comment_placeholder: "Kommentar hier schreiben...",
image_tags: "Bild-Tags",
image_tags_classification_placeholder: "Bildklassifikation",
image_tags_object_detection_placeholder: "Bildklassifikation",
loading: "Laden...",
note: "Hinweis",
here: "hier",
Expand Down
4 changes: 2 additions & 2 deletions client/src/Localization/translation-en-EN.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const translationEnEN = {
"setup.tabs.images": "Images",
"setup.tabs.taskinfo.task_info": "Task Information",
"setup.tabs.taskinfo.task_choice": "Choice of Task",
"setup.tabs.taskinfo.task_choice_classification": "Image Classification",
"setup.tabs.taskinfo.task_choice_object_detection": "Object Detection",
"setup.tabs.taskinfo.task_choice_segmentation": "Image Segmentation",
"configuration.multiple_regions": "Can Multiple Regions Be Created?",
"configuration.multiple_region_labels": "Multiple Region Labels Allowed?",
Expand Down Expand Up @@ -69,7 +69,7 @@ const translationEnEN = {
auto_bounding_box_done: "Auto Bouding Box Selection Completed",
comment_placeholder: "Write comment here...",
image_tags: "Image Tags",
image_tags_classification_placeholder: "Image Classification",
image_tags_object_detection_placeholder: "Object Detection",
loading: "Loading...",
note: "Note",
here: "here",
Expand Down
2 changes: 1 addition & 1 deletion client/src/SettingsProvider/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const defaultSettings = {
wasdMode: true,
settings: {
taskDescription: "",
taskChoice: "image_classification",
taskChoice: "object_detection",
images: [],
showLab: false,
lastSavedImageIndex: null,
Expand Down
6 changes: 3 additions & 3 deletions client/src/SetupPage/SetupPage.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ jest.mock("../SettingsProvider", () => ({
}))

// Mock dependent components
jest.mock("../ConfigureImageClassification", () =>
jest.fn(() => <div data-testid="ConfigureImageClassification" />),
jest.mock("../ConfigureObjectDetection", () =>
jest.fn(() => <div data-testid="ConfigureObjectDetection" />),
)
jest.mock("../ConfigureImageSegmentation", () =>
jest.fn(() => <div data-testid="ConfigureImageSegmentation" />),
Expand All @@ -53,7 +53,7 @@ describe("SetupPage", () => {
taskDescription: "",
configuration: { labels: [] },
images: [],
taskChoice: "image_classification",
taskChoice: "object_detection",
}
const mockSetConfiguration = jest.fn()
const mockSetShowLabel = jest.fn()
Expand Down
6 changes: 3 additions & 3 deletions client/src/SetupPage/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import CardContent from "@mui/material/CardContent"
import Typography from "@mui/material/Typography"
import IconButton from "@mui/material/IconButton"
import PropTypes from "prop-types"
import ConfigureImageClassification from "../ConfigureImageClassification"
import ConfigureObjectDetection from "../ConfigureObjectDetection"
import ConfigureImageSegmentation from "../ConfigureImageSegmentation"
import Button from "@mui/material/Button"
import ConfigurationTask from "../ConfigurationTask"
Expand Down Expand Up @@ -274,9 +274,9 @@ export const SetupPage = ({

{currentTab === "configure" && (
<Box minWidth="55vw" paddingTop={"1rem"}>
{settings.taskChoice === "image_classification" && (
{settings.taskChoice === "object_detection" && (
<>
<ConfigureImageClassification
<ConfigureObjectDetection
config={settings.configuration}
onChange={updateConfiguration}
/>
Expand Down
4 changes: 2 additions & 2 deletions client/src/TagsSidebarBox/TagsSidebarBox.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jest.mock("react-i18next", () => ({
t: (key) =>
({
image_tags: "Image Tags",
image_tags_classification_placeholder: "Image Classification",
image_tags_object_detection_placeholder: "Object Detection",
})[key],
}),
}))
Expand Down Expand Up @@ -38,7 +38,7 @@ describe("TagsSidebarBox", () => {
/>,
)

it("renders correctly with image classification and tags", () => {
it("renders correctly with object detection and tags", () => {
renderComponent()
// Check if title is rendered
expect(screen.getByText("Image Tags")).toBeInTheDocument()
Expand Down
2 changes: 1 addition & 1 deletion client/src/TagsSidebarBox/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export const TagsSidebarBox = ({
{imageClsList.length > 0 && (
<div style={{ padding: 8 }}>
<Select
placeholder={t("image_tags_classification_placeholder")}
placeholder={t("image_tags_object_detection_placeholder")}
onChange={onChangeClassification}
value={selectValue}
options={memoImgClsList}
Expand Down
2 changes: 1 addition & 1 deletion server/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@

default_settings = {
"taskDescription": "",
"taskChoice": "image_classification",
"taskChoice": "object_detection",
"images": [],
"showLab": False,
"mode": "light",
Expand Down
4 changes: 2 additions & 2 deletions server/settings.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"taskDescription": "",
"taskChoice": "image_classification",
"taskChoice": "object_detection",
"images": [],
"showLab": true,
"showLab": false,
"mode": "light",
"lastSavedImageIndex": null,
"configuration": {
Expand Down
2 changes: 1 addition & 1 deletion server/tests/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def test_get_initial_settings(self):
self.assertEqual(response.status_code, 200)
data = json.loads(response.data)
self.assertEqual(data["taskDescription"], "")
self.assertEqual(data["taskChoice"], "image_classification")
self.assertEqual(data["taskChoice"], "object_detection")

def test_update_settings(self):
updated_settings = {
Expand Down
Loading