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

Object Detection Train #840

Open
wants to merge 28 commits into
base: nextjs
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
319d319
implemented object_detection_parameters and added object detection files
Dashrekker May 30, 2023
2abfd83
removed detect from navbar, updated trainconstants, and added detect …
Dashrekker Jun 8, 2023
d198913
Merge branch 'nextjs' of https://github.com/DSGT-DLP/Deep-Learning-Pl…
Dashrekker Jun 13, 2023
9e75904
removed playground-frontend and moved object detection
Dashrekker Jun 13, 2023
68b4541
added renderstepperbuttons to detectionimagestep
Dashrekker Jun 18, 2023
a2213bf
added image upload layout file for filerobot implementation
Dashrekker Jun 25, 2023
987479a
converted transforms panel to a grid and implemented detectiontype st…
Dashrekker Jun 25, 2023
3fdec37
Merge branch 'nextjs' of https://github.com/DSGT-DLP/Deep-Learning-Pl…
Dashrekker Jun 25, 2023
76284f4
fixed float not supported issue with update dynamo item and modified …
Dashrekker Jun 26, 2023
24bc681
:art: Format Python code with psf/black
Dashrekker Jun 26, 2023
9ba222b
removed prints and changed imagedata to datasetdata
Dashrekker Jun 28, 2023
a6624d5
fixed eslint errors
Dashrekker Jun 28, 2023
295f533
fixed eslint errors
Dashrekker Jun 28, 2023
f482f98
removed font style from navbar
Dashrekker Jun 28, 2023
0887de4
Merge branch 'nextjs' of https://github.com/DSGT-DLP/Deep-Learning-Pl…
Dashrekker Jun 28, 2023
7ec4160
changed problem_type to detection_type in detectionapi
Dashrekker Jun 28, 2023
b0ac633
Merge branch 'nextjs' of https://github.com/DSGT-DLP/Deep-Learning-Pl…
Dashrekker Jun 28, 2023
533e4f5
changed any to unknown
Dashrekker Jul 2, 2023
eb1cbc7
implemented dynamic imports on imageupload page
Dashrekker Jul 2, 2023
3867f26
fixed type and refresh
Dashrekker Jul 3, 2023
087b38f
removed extra stuff from transforms
Dashrekker Jul 3, 2023
f9157f2
removed transform type
Dashrekker Jul 3, 2023
f372527
Merge branch 'nextjs' of https://github.com/DSGT-DLP/Deep-Learning-Pl…
Dashrekker Jul 9, 2023
21e12c9
implemented toastui with toastui wrapper class
Dashrekker Jul 28, 2023
6942b4d
Merge branch 'nextjs' of https://github.com/DSGT-DLP/Deep-Learning-Pl…
Dashrekker Jul 28, 2023
ea404b7
changed editor ref to ref and added functionality to toast ui
Dashrekker Jul 28, 2023
69504ea
fixed linter errors and uninstalled filerobot
Dashrekker Jul 28, 2023
1792942
Merge branch 'nextjs' of https://github.com/DSGT-DLP/Deep-Learning-Pl…
Dashrekker Jul 28, 2023
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
7 changes: 6 additions & 1 deletion backend/aws_helpers/dynamo_db_utils/dynamo_db_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
import random
from datetime import datetime
from typing import Union
import traceback
import json
from decimal import Decimal

dynamodb = boto3.resource("dynamodb", region_name=AWS_REGION)

Expand Down Expand Up @@ -127,7 +130,9 @@ def create_dynamo_item(table_name: str, input_item: dict) -> bool:

# Create item
table = dynamodb.Table(table_name)
response = table.put_item(Item=input_item)
jsonstring = json.dumps(input_item)
ddb_data = json.loads(jsonstring, parse_float=Decimal)
response = table.put_item(Item=ddb_data)
if response["ResponseMetadata"]["HTTPStatusCode"] != 200:
raise Exception("Failed to delete item")
return True
Expand Down
38 changes: 36 additions & 2 deletions backend/endpoints/train_endpoints.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from dataclasses import asdict
from decimal import Decimal
import shutil
import traceback
import uuid
Expand Down Expand Up @@ -175,6 +173,41 @@ def object_detection_run():
Returns:
_type_: _description_
"""
try:
request_data = json.loads(request.data)
id = str(uuid.uuid4())
detection_data = TrainspaceData(
trainspace_id=id,
uid=request.environ["user"]["uid"],
created=get_current_timestamp(),
data_source="OBJECT_DETECTION",
dataset_data=request_data["dataset_data"],
name=request_data["name"],
parameters_data=request_data["parameters_data"],
review_data=request_data["review_data"],
)

try:
createTrainspaceData(detection_data)
print(id)
return send_success({"message": "success", "trainspace_id": id})
except Exception:
print(traceback.format_exc())
return send_traceback_error()

""" train_loss_results = dl_tabular_drive(
user_arch, fileURL, params, json_csv_data_str, customModelName
)
train_loss_results["user_arch"] = user_arch
print(train_loss_results)
updateStatus(execution_id, "SUCCESS") """
# return send_train_results(train_loss_results)

except Exception:
# updateStatus(execution_id, "ERROR")
print(traceback.format_exc())
return send_traceback_error()
"""
IMAGE_UPLOAD_FOLDER = "./backend/image_data_uploads"
try:
request_data = json.loads(request.data)
Expand All @@ -198,3 +231,4 @@ def object_detection_run():
os.remove(file_rem)
if os.path.exists(UNZIPPED_DIR_NAME):
shutil.rmtree(UNZIPPED_DIR_NAME)
"""
10 changes: 5 additions & 5 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@
"@codemirror/lang-python": "^6.0.2",
"@dnd-kit/core": "^6.0.8",
"@dnd-kit/sortable": "^7.0.2",
"@emotion/react": "^11.10.0",
"@emotion/styled": "^11.10.0",
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@mui/icons-material": "^5.11.16",
"@mui/material": "^5.9.3",
"@mui/material": "^5.14.2",
"@mui/x-data-grid": "^6.0.4",
"@reduxjs/toolkit": "^1.8.5",
"@testing-library/react": "^14.0.0",
"@testing-library/user-event": "^13.5.0",
"@toast-ui/react-image-editor": "^3.15.2",
"@types/crypto-js": "^4.1.1",
"@types/file-saver": "^2.0.5",
"@types/gestalt": "^101.0.0",
Expand Down Expand Up @@ -57,12 +58,11 @@
"react-csv": "^2.2.2",
"react-data-table-component": "^7.5.2",
"react-dom": "^18.1.0",
"react-filerobot-image-editor": "^4.3.7",
"react-google-recaptcha": "^2.1.0",
"react-hook-form": "^7.43.9",
"react-icons": "^4.4.0",
"react-plotly.js": "^2.5.1",
"react-redux": "^8.0.4",
"react-redux": "^8.1.1",
"react-select": "^5.3.2",
"react-syntax-highlighter": "^15.5.0",
"react-toastify": "^9.0.7",
Expand Down
110 changes: 67 additions & 43 deletions frontend/src/common/components/NavBarMain.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import AppBar from '@mui/material/AppBar';
import AppBar from "@mui/material/AppBar";
import { FormControlLabel, Icon, Switch } from "@mui/material";
import Toolbar from '@mui/material/Toolbar';
import Typography from '@mui/material/Typography';
import MenuList from '@mui/material/Menu';
import Container from '@mui/material/Container';
import Button from '@mui/material/Button';
import MenuItem from '@mui/material/MenuItem';
import Toolbar from "@mui/material/Toolbar";
import Typography from "@mui/material/Typography";
import MenuList from "@mui/material/Menu";
import Container from "@mui/material/Container";
import Button from "@mui/material/Button";
import MenuItem from "@mui/material/MenuItem";
import Grid from "@mui/material/Grid";
import ArrowDropDownIcon from '@mui/icons-material/ArrowDropDown';
import ArrowDropDownIcon from "@mui/icons-material/ArrowDropDown";

import storage from "local-storage-fallback";
import React, { useEffect, useState } from "react";
Expand Down Expand Up @@ -63,14 +63,15 @@ const NavbarMain = () => {
<ThemeProvider theme={theme}>
<AppBar id="navbar-main" className="p-0" position="static">
<Container maxWidth="lg">
<Toolbar disableGutters
<Toolbar
disableGutters
sx={{
display: { xs: "flex" },
flexDirection: "row",
justifyContent: "space-between"
justifyContent: "space-between",
}}
>
<Icon sx={{ display: { xs: 'none', md: 'flex' }, ml: -5, mr: 1 }}>
<Icon sx={{ display: { xs: "none", md: "flex" }, ml: -5, mr: 1 }}>
<Image src={DSGTLogo} alt="DSGT Logo" width={40} height={40} />
</Icon>
<Typography
Expand All @@ -81,90 +82,113 @@ const NavbarMain = () => {
className="d-flex align-items-center logo-title"
sx={{
mr: 2,
display: { xs: 'none', md: 'flex' },
fontFamily: 'Lato, Arial, Helvetica, sans-serif',
color: 'inherit',
textDecoration: 'none',
display: { xs: "none", md: "flex" },
color: "inherit",
textDecoration: "none",
}}
>
Deep Learning Playground
</Typography>

<Grid sx={{ flexGrow: 1, display: { xs: 'none', md: 'flex', justifyContent:'right'} }}>
<Grid
sx={{
flexGrow: 1,
display: { xs: "none", md: "flex", justifyContent: "right" },
}}
>
<Grid item>
{isSignedIn(user) ? (
<Link href="/train" passHref className="nav-link">Train</Link>
) : null}
{isSignedIn(user) ? (
<Link href="/train" passHref className="nav-link">
Train
</Link>
) : null}
</Grid>
<Grid item>
<Link href="/about" passHref className="nav-link">About</Link>
<Link href="/about" passHref className="nav-link">
About
</Link>
</Grid>
<Grid item>
<Link href="/wiki" passHref className="nav-link">Wiki</Link>
<Link href="/wiki" passHref className="nav-link">
Wiki
</Link>
</Grid>
<Grid item>
<Link href="/feedback" passHref className="nav-link">Feedback</Link>
<Link href="/feedback" passHref className="nav-link">
Feedback
</Link>
</Grid>
<Grid item>
<Link href={URLs.donate} passHref className="nav-link">Donate</Link>
<Link href={URLs.donate} passHref className="nav-link">
Donate
</Link>
</Grid>
{isSignedIn(user) ? (
<Grid item>
<div>
<Button
<Button
sx={{
my: -0.75,
mx: -1,
}}>
<Typography
onClick={handleOpenUserMenu}
className="nav-link"
style={{
fontFamily: 'Lato, Arial, Helvetica, sans-serif',
textTransform: 'none'
}}
>
Account <ArrowDropDownIcon />
</Typography>
</Button>
}}
>
<Typography
onClick={handleOpenUserMenu}
className="nav-link"
style={{
fontFamily: "Lato, Arial, Helvetica, sans-serif",
textTransform: "none",
}}
>
Account <ArrowDropDownIcon />
</Typography>
</Button>
<MenuList
anchorEl={anchorEl}
open={open}
onClose={handleCloseUserMenu}
>
<MenuItem>
<Link href="/dashboard" id="basic-nav-dropdown">Dashboard</Link>
<Link href="/dashboard" id="basic-nav-dropdown">
Dashboard
</Link>
</MenuItem>
<MenuItem>
<Link href="/settings" id="basic-nav-dropdown">Settings</Link>
<Link href="/settings" id="basic-nav-dropdown">
Settings
</Link>
</MenuItem>
<MenuItem divider>
<Link href="/learn-mod" id="basic-nav-dropdown">Learn</Link>
<Link href="/learn-mod" id="basic-nav-dropdown">
Learn
</Link>
</MenuItem>
<Link href={""} passHref id="basic-nav-dropdown">
<MenuItem
onClick={() => {
dispatch(signOutUser());
}}
>
<Typography sx={{fontFamily:'Lato, Arial, Helvetica, sans-serif'}}>Log out</Typography>
<Typography>Log out</Typography>
</MenuItem>
</Link>
</MenuList>
</div>
</Grid>
) : (
<Link href="/login" passHref className="nav-link">Log in</Link>
<Link href="/login" passHref className="nav-link">
Log in
</Link>
)}
</Grid>
<FormControlLabel
style={{
marginLeft: "auto",
marginRight: 0,
flexDirection: "row-reverse"
flexDirection: "row-reverse",
}}
control={
<Switch
<Switch
id="mode-switch"
onChange={toggleTheme}
checked={theme.checked}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import {
Tab,
Tabs,
Typography,
Paper,
Alert,
} from "@mui/material";
import { useAppSelector } from "@/common/redux/hooks";
Expand Down
Loading
Loading