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 19 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 @@ -4,6 +4,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 @@ -124,7 +127,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
56 changes: 51 additions & 5 deletions backend/aws_helpers/dynamo_db_utils/trainspace_db.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
from backend.aws_helpers.dynamo_db_utils.constants import (
TRAINSPACE_TABLE_NAME,
TrainStatus,
)
from backend.aws_helpers.dynamo_db_utils.constants import TRAINSPACE_TABLE_NAME
from backend.aws_helpers.dynamo_db_utils.dynamo_db_utils import (
create_dynamo_item,
get_dynamo_item_by_key,
Expand All @@ -27,7 +24,56 @@ class TrainspaceData:
name: str = ""
parameters_data: dict = None
review_data: str = ""
status: TrainStatus = TrainStatus.QUEUED
status: str = ""


"""
@dataclass
class LayerData(BaseData):
value: str
parameters: list[Any]


@dataclass
class TabularParametersData(BaseData):
target_col: str
features: list[str]
problem_type: str
criterion: str
optimizer_name: str
shuffle: bool
epochs: int
test_size: float
batch_size: int
layers: list[LayerData]

@dataclass
class DetectionParametersData(BaseData):
detection_type: str
detection_problem_type: str
transforms: list[LayerData]

@dataclass
class TabularData(TrainspaceData):
dataset_data: DatasetData
parameters_data: TabularParametersData
review_data: ReviewData


@enumclass(
DataClass=TrainspaceData,
data_source=[
"TABULAR",
"PRETRAINED",
"IMAGE",
"AUDIO",
"TEXTUAL",
"CLASSICAL_ML",
"OBJECT_DETECTION",
],
# status=["QUEUED", "STARTING", "UPLOADING", "TRAINING", "SUCCESS", "ERROR"],
)
"""


def getTrainspaceData(trainspace_id: str) -> dict:
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)
"""
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 @@ -65,14 +65,15 @@ const NavbarMain = () => {
<GlobalStyle />
<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 @@ -83,90 +84,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