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

Features for V0.55 #118

Merged
merged 68 commits into from
Aug 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
e5bbdce
Merge pull request #3 from datature/develop
gkeechin Jun 29, 2021
2abfb59
Merge pull request #4 from datature/staging
gkeechin Jun 29, 2021
fcacdf1
Merge pull request #69 from datature/develop
beesaycheese Jul 26, 2021
d3c4a69
Re-Exported Portal to Portal Build
github-actions[bot] Jul 26, 2021
dcf9792
Merge pull request #72 from datature/staging
gkeechin Jul 26, 2021
eab7211
Merge pull request #74 from datature/develop
beesaycheese Jul 26, 2021
4819645
Merge pull request #75 from datature/staging
gkeechin Jul 26, 2021
9b90f0d
Merge pull request #77 from datature/develop
beesaycheese Jul 26, 2021
d983a31
Merge pull request #78 from datature/staging
gkeechin Jul 26, 2021
76dfd92
Merge pull request #80 from datature/develop
beesaycheese Jul 26, 2021
a4dcd35
Merge pull request #81 from datature/staging
beesaycheese Jul 26, 2021
8350de6
Merge pull request #83 from datature/develop
beesaycheese Jul 26, 2021
4e03685
Merge pull request #84 from datature/staging
beesaycheese Jul 26, 2021
fd5e60c
Merge pull request #87 from datature/develop
beesaycheese Jul 26, 2021
c95e038
Re-Exported Portal to Portal Build
github-actions[bot] Jul 26, 2021
cdad830
Merge pull request #88 from datature/staging
beesaycheese Jul 26, 2021
c506ce8
Merge pull request #91 from datature/develop
beesaycheese Jul 27, 2021
4f15a70
Re-Exported Portal to Portal Build
github-actions[bot] Jul 27, 2021
8563f33
Merge pull request #92 from datature/staging
beesaycheese Jul 27, 2021
7007cd9
Model class will not be json-pickled when caching is disabled
marcus-neo Jul 27, 2021
b8cf3d9
Changed Cache saving/loading algorithms
marcus-neo Jul 27, 2021
2ad2413
Merge pull request #98 from datature/develop
beesaycheese Jul 28, 2021
197c8ce
Merge pull request #99 from datature/staging
beesaycheese Jul 28, 2021
e36114c
Merge pull request #100 from datature/develop
beesaycheese Jul 28, 2021
4b06f53
Merge pull request #101 from datature/staging
beesaycheese Jul 28, 2021
f3b446f
Merge pull request #102 from datature/develop
beesaycheese Jul 28, 2021
774871e
Merge pull request #103 from datature/staging
beesaycheese Jul 28, 2021
95705be
Merge pull request #108 from datature/develop
beesaycheese Jul 28, 2021
78c69e2
Merge pull request #109 from datature/staging
beesaycheese Jul 28, 2021
3436b32
Merge pull request #110 from datature/develop
gkeechin Jul 28, 2021
6cd398e
Merge pull request #111 from datature/staging
gkeechin Jul 28, 2021
e888fe1
quick fix to set frame interval default to 1
marcus-neo Jul 30, 2021
66aeaa2
Changes To Caching System
marcus-neo Aug 2, 2021
272539e
Merge branch 'release' into v0.5.5/Develop
marcus-neo Aug 2, 2021
5bd7202
Merge pull request #116 from datature/fixes/caching-system
marcus-neo Aug 2, 2021
220472a
Merge branch 'v0.5.5/Develop' of https://github.com/datature/portal i…
marcus-neo Aug 2, 2021
112a512
Created front-end support for endpoint
marcus-neo Aug 3, 2021
eb95005
Created Backend skeleton for endpoint
marcus-neo Aug 3, 2021
56b8023
Changed tab settings rendering to switch case
marcus-neo Aug 3, 2021
ee94aee
Merge pull request #117 from datature/feature/hosted-deployment-support
marcus-neo Aug 3, 2021
dc0604a
Linting Fixes
marcus-neo Aug 3, 2021
ef5d795
Linting Fixes
marcus-neo Aug 3, 2021
002240b
Pylint fixes
marcus-neo Aug 3, 2021
5bc606b
Revert "Merge branch 'release' into v0.5.5/Develop"
marcus-neo Aug 4, 2021
8d87fd9
Update .gitignore
marcus-neo Aug 4, 2021
d4e55f3
removed unneeded .gitkeep files
marcus-neo Aug 4, 2021
4904830
Update .gitignore
marcus-neo Aug 4, 2021
a6a4a2b
created caching toggle feature
marcus-neo Aug 4, 2021
266879f
Prevent popup from showing up after autosave toggle
marcus-neo Aug 4, 2021
dafee61
(wip) provide support for hosted deployment
marcus-neo Aug 5, 2021
d01862b
(wip) update mask support for hosted deployment models
marcus-neo Aug 5, 2021
83169ad
fixed small bug
marcus-neo Aug 5, 2021
894f0c7
removed image array from nms function
marcus-neo Aug 5, 2021
f48d0cb
refactored back_to_tensor to become back_to_array
marcus-neo Aug 5, 2021
f805f2b
testing changing tf.device
marcus-neo Aug 5, 2021
3d62ca6
reverted cpu device
marcus-neo Aug 6, 2021
9b2109f
Endpoint models now loads the label map upon registration
marcus-neo Aug 6, 2021
8747806
Changed front-end "model key" input box into " URL"
marcus-neo Aug 6, 2021
1372a0f
endpoint models will now not be stored in cache
marcus-neo Aug 6, 2021
d181bc1
Merge pull request #119 from datature/feature/cache-option
marcus-neo Aug 6, 2021
91accce
fixed unnecessary if statement
marcus-neo Aug 6, 2021
574aa32
lint fixes for prettier
marcus-neo Aug 6, 2021
3405189
Merge branch 'v0.5.5/Develop' into feture/hosted-deployment
marcus-neo Aug 6, 2021
4dcefa9
Merge pull request #120 from datature/feture/hosted-deployment
marcus-neo Aug 6, 2021
b0cf0a3
Minor changes, docstring and contributions
marcus-neo Aug 6, 2021
07e1caf
eslint fix
marcus-neo Aug 6, 2021
664de6a
Merge pull request #115 from datature/hotfix/change-default-frame-int…
marcus-neo Aug 6, 2021
555bdf5
Fixed small bug with store_cache boolean not being optional in the de…
marcus-neo Aug 10, 2021
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
10 changes: 6 additions & 4 deletions docs/contribution.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,14 @@ The steps to creating a custom model can be done in a several steps:
```
- return (`self._key_`, self) as a tuple.
- `load(self)`
- Load the model into a variable and return that variable
- Load the model into a variable and save that variable into `self._model_`.
```python
loaded_model = load_the_model(<model_path>)
return loaded_model
self._model_ = loaded_model
```
- `predict(self, model, image_array)`
- `predict(self, image_array)`

- Take in the model and perform inference on the image array.
- Perform inference on the image array.
- Return the inference as a dictionary of

```python
Expand All @@ -107,6 +107,8 @@ The steps to creating a custom model can be done in a several steps:
}
```

NOTE: The segmentation masks are in the form of image masks, not bounding box masks.

You may also define other functions, but these functions are the basic necessity.

5. In the [Model Factory](../src/engine/server/models/abstract/Model.py) `src/engine/server/models/abstract/Model.py`, import and add your your custom model class into the `model_class` dictionary.
Expand Down
24 changes: 23 additions & 1 deletion src/app/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ import dynamic from "next/dynamic";
import { Classes } from "@blueprintjs/core";
import { setConfiguration } from "react-grid-system";
import HeaderNav from "@portal/components/ui/header/navbar";
import { APIGetGPU } from "@portal/api/general";
import {
APIGetGPU,
APIAutosaveQuery,
APIAutosaveToggle,
} from "@portal/api/general";

/* Global Setting / Styling */
const THEME_LOCAL_STORAGE_KEY = "nexus-theme";
Expand All @@ -29,12 +33,14 @@ class Annotation extends React.Component {
useDarkTheme: true,
loadedModel: undefined,
isConnected: false,
isAutosave: false,
};

/* Grid Layout Configuration */
setConfiguration({ gutterWidth: 12 });
this.setTheme = this.setTheme.bind(this);
this.setGPU = this.setGPU.bind(this);
this.setAutosave = this.setAutosave.bind(this);
}

componentDidMount() {
Expand All @@ -49,6 +55,13 @@ class Annotation extends React.Component {
this.setState({ isGPU: true });
}
});

// Call for the autosave settings from the backend
APIAutosaveQuery().then(res => {
if (res.data === 1) {
this.setState({ isAutosave: true });
}
});
}

setTheme(flag) {
Expand All @@ -62,6 +75,14 @@ class Annotation extends React.Component {
this.setState({ isGPU: flag });
}

async setAutosave(flag) {
APIAutosaveToggle(flag).then(res => {
if (res.status === 200) {
this.setState({ isAutosave: flag });
}
});
}

render() {
return (
<>
Expand Down Expand Up @@ -105,6 +126,7 @@ class Annotation extends React.Component {
GlobalSettingCallback={{
setTheme: this.setTheme,
setGPU: this.setGPU,
setAutosave: this.setAutosave,
handleIsConnected: isConnected => {
this.setState({ isConnected });
},
Expand Down
4 changes: 3 additions & 1 deletion src/app/src/api/annotation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ export function APIRegisterModel(
description: string,
directory: string,
modelKey: string,
projectSecret: string
projectSecret: string,
modelURL: string
): Promise<AxiosResponse<any>> {
const config = {
type,
Expand All @@ -146,6 +147,7 @@ export function APIRegisterModel(
credentials: {
modelKey,
projectSecret,
modelURL,
},
directory,
};
Expand Down
16 changes: 16 additions & 0 deletions src/app/src/api/general.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import {
GET_GPU,
SET_GPU,
CLEAR_GPU,
AUTOSAVE_QUERY,
AUTOSAVE_TOGGLE,
} from "@portal/constants/api";

export function APIIsAlive(isElectron: boolean): Promise<AxiosResponse<any>> {
Expand All @@ -23,6 +25,8 @@ export function APIShutdown(
});
}

/* -------------- CACHE API -------------- */

export function APILoadCache(): Promise<AxiosResponse<any>> {
return axios.post(SERVER_ADDRESS + CACHE);
}
Expand All @@ -31,6 +35,18 @@ export function APIRejectCache(): Promise<AxiosResponse<any>> {
return axios.put(SERVER_ADDRESS + CACHE);
}

/* -------------- AUTOSAVE API -------------- */

export function APIAutosaveQuery(): Promise<AxiosResponse<any>> {
return axios.get(SERVER_ADDRESS + AUTOSAVE_QUERY);
}

export function APIAutosaveToggle(flag: boolean): Promise<AxiosResponse<any>> {
return axios.post(
SERVER_ADDRESS + AUTOSAVE_TOGGLE + "/" + (flag ? "on" : "off")
);
}

/* -------------- GPU API -------------- */

export function APIGetGPU(): Promise<AxiosResponse<any>> {
Expand Down
2 changes: 1 addition & 1 deletion src/app/src/components/annotations/annotator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ export default class Annotator extends Component<
cacheResults: false,
iou: 0.8,
video: {
frameInterval: 20,
frameInterval: 1,
},
},
currAnnotationPlaybackId: 0,
Expand Down
135 changes: 101 additions & 34 deletions src/app/src/components/annotations/model.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export type FormData = {
directory: string;
modelKey: string;
projectSecret: string;
modelURL: string;
modelType: "tensorflow" | "darknet" | "";
};

Expand Down Expand Up @@ -131,6 +132,7 @@ export default class Model extends React.Component<ModelProps, ModelState> {
directory: "",
modelKey: "",
projectSecret: "",
modelURL: "",
},
drawerTabId: "details",
registrationTabId: "local",
Expand Down Expand Up @@ -190,7 +192,7 @@ export default class Model extends React.Component<ModelProps, ModelState> {

/** -------- Methods related to API calls -------- */

/** Calls the Model Registratiion API with info recorded in formData */
/** Calls the Model Registration API with info recorded in formData */
private handleRegisterModel = async () => {
this.setState({ isAPIcalled: true });
if (
Expand All @@ -213,6 +215,17 @@ export default class Model extends React.Component<ModelProps, ModelState> {
Intent.WARNING,
3000
);
} else if (
this.state.formData.type === "endpoint" &&
(this.state.formData.modelURL === "" ||
this.state.formData.projectSecret === "" ||
this.state.formData.name === "")
) {
CreateGenericToast(
"Please fill in the name, URL and project secret of the model you want to load from endpoint.",
Intent.WARNING,
3000
);
} else {
await APIRegisterModel(
this.state.formData.type,
Expand All @@ -221,7 +234,8 @@ export default class Model extends React.Component<ModelProps, ModelState> {
this.state.formData.description,
this.state.formData.directory,
this.state.formData.modelKey,
this.state.formData.projectSecret
this.state.formData.projectSecret,
this.state.formData.modelURL
)
.then(result => {
if (result.status === 200) {
Expand Down Expand Up @@ -505,6 +519,80 @@ export default class Model extends React.Component<ModelProps, ModelState> {
return dict;
};

/** Render Tab Input Settings based on registrationTabId.
* @param registrationTabId : the tab id of the tab to be rendered
* @return jsx : the tab input settings
*/
private renderTabSettings = (
registrationTabId: TabId,
browseButton: JSX.Element,
browseHint: JSX.Element
) => {
switch (registrationTabId) {
case "local":
return (
<FormGroup label="Folder Path" labelFor="label-input">
<InputGroup
id="directory"
name="directory"
value={this.state.formData.directory}
placeholder={"Enter model folder path..."}
onChange={this.handleChangeForm}
rightElement={isElectron() ? browseButton : browseHint}
/>
</FormGroup>
);
case "hub":
return (
<>
<FormGroup label="Model Key" labelFor="label-input">
<InputGroup
id="modelKey"
name="modelKey"
value={this.state.formData.modelKey}
placeholder="Enter model key from hub..."
onChange={this.handleChangeForm}
/>
</FormGroup>
<FormGroup label="Project Secret" labelFor="label-input">
<InputGroup
id="projectSecret"
name="projectSecret"
value={this.state.formData.projectSecret}
placeholder="Enter project secret from hub..."
onChange={this.handleChangeForm}
/>{" "}
</FormGroup>
</>
);
case "endpoint":
return (
<>
<FormGroup label="Endpoint URL" labelFor="label-input">
<InputGroup
id="modelURL"
name="modelURL"
value={this.state.formData.modelURL}
placeholder="Enter the URL from endpoint..."
onChange={this.handleChangeForm}
/>
</FormGroup>
<FormGroup label="Project Secret" labelFor="label-input">
<InputGroup
id="projectSecret"
name="projectSecret"
value={this.state.formData.projectSecret}
placeholder="Enter project secret from endpoint..."
onChange={this.handleChangeForm}
/>{" "}
</FormGroup>
</>
);
default:
return null;
}
};

/** Create MenuItems from the registereModelList
* @return {Array<MenuItem>} An array of registered models in the format of MenuItems
*/
Expand Down Expand Up @@ -584,6 +672,7 @@ export default class Model extends React.Component<ModelProps, ModelState> {
directory: "",
modelKey: "",
projectSecret: "",
modelURL: "",
},
registrationTabId: tabId,
});
Expand Down Expand Up @@ -717,38 +806,10 @@ export default class Model extends React.Component<ModelProps, ModelState> {
onChange={this.handleChangeForm}
/>
</FormGroup>
{this.state.registrationTabId === "local" ? (
<FormGroup label="Folder Path" labelFor="label-input">
<InputGroup
id="directory"
name="directory"
value={this.state.formData.directory}
placeholder={"Enter model folder path..."}
onChange={this.handleChangeForm}
rightElement={isElectron() ? browseButton : browseHint}
/>
</FormGroup>
) : (
<>
<FormGroup label="Model Key" labelFor="label-input">
<InputGroup
id="modelKey"
name="modelKey"
value={this.state.formData.modelKey}
placeholder="Enter model key from hub..."
onChange={this.handleChangeForm}
/>
</FormGroup>
<FormGroup label="Project Secret" labelFor="label-input">
<InputGroup
id="projectSecret"
name="projectSecret"
value={this.state.formData.projectSecret}
placeholder="Enter project secret from hub..."
onChange={this.handleChangeForm}
/>{" "}
</FormGroup>
</>
{this.renderTabSettings(
this.state.registrationTabId,
browseButton,
browseHint
)}
<Button
type="submit"
Expand Down Expand Up @@ -971,6 +1032,11 @@ export default class Model extends React.Component<ModelProps, ModelState> {
>
<Tab id="local" title="Local" />
<Tab id="hub" title="Datature Hub" />
<Tab
id="endpoint"
title="Datature API (Coming Soon)"
disabled={true}
/>
<Tabs.Expander />
</Tabs>
</NavbarGroup>{" "}
Expand All @@ -992,6 +1058,7 @@ export default class Model extends React.Component<ModelProps, ModelState> {
directory: "",
modelKey: "",
projectSecret: "",
modelURL: "",
},
registrationTabId: "local",
isOpenRegistraionForm: false,
Expand Down
11 changes: 11 additions & 0 deletions src/app/src/components/ui/header/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,17 @@ export default class QuickSetting extends React.Component {
/>
</Tooltip>
</FormGroup>
<FormGroup label={<b>Autosave</b>}>
<Switch
label={"Autosave Progress"}
checked={this.props.GlobalSetting.isAutosave}
onChange={event => {
this.props.GlobalSettingCallback.setAutosave(
event.target.checked
);
}}
/>
</FormGroup>
</>
);
}
Expand Down
4 changes: 4 additions & 0 deletions src/app/src/constants/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ export const IS_ALIVE = `/heartbeat`;
export const SHUTDOWN = `/shutdown`;
export const CACHE = `/cache`;

// Autosave Query route
export const AUTOSAVE_QUERY = `/autosave`;
export const AUTOSAVE_TOGGLE = `/autosave/toggle`;

// Assets/folders routes
export const POST_PROJECT_REGISTER_IMAGES = `/api/project/register`;
export const GET_PROJECT_ASSETS = `/api/project/assets`;
Expand Down
Loading