-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [chaos] Create local configs * [chaos] Create ci configs * [chaos] Create ignore file * [chaos] Reference right packages * [chaos] Autofix eslint errors * [chaos] Configure root imports * [chaos] Use absolute imports * [chaos] Change eslint configs * [chaos] Fix eslint errors * [chaos] Change lint scripts * [chaos] Change ci dockerfile * [chaos] Change node version * [chaos] Change from dockerfile * [chaos] Change release dockerfile
- Loading branch information
1 parent
e8634c7
commit 2c75d60
Showing
37 changed files
with
1,224 additions
and
233 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.node_modules | ||
doc | ||
scripts | ||
build | ||
src/serviceWorkerRegistration.js | ||
src/service-worker.js | ||
src/reportWebVitals.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
FROM node:14.16-alpine | ||
FROM node:14.17-alpine | ||
WORKDIR /srv/hermes.cam | ||
|
||
COPY package.json ./ | ||
COPY yarn.lock ./ | ||
|
||
RUN npm install | ||
RUN yarn install | ||
|
||
RUN rm package.json | ||
RUN rm yarn.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"compilerOptions": { | ||
"baseUrl": "src" | ||
}, | ||
"include": [ | ||
"src" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import React from "react"; | ||
import Webcam from "react-webcam"; | ||
import React from 'react' | ||
import Webcam from 'react-webcam' | ||
|
||
import {useContext} from "./context"; | ||
import { useContext } from 'camera/context' | ||
|
||
export const Camera = () => { | ||
const {camera} = useContext() | ||
const { camera } = useContext() | ||
|
||
return <Webcam ref={camera} videoConstraints={{facingMode: "environment"}} /> | ||
return <Webcam ref={camera} videoConstraints={{ facingMode: 'environment' }} /> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
import React from "react"; | ||
import React from 'react' | ||
import PropTypes from 'prop-types' | ||
|
||
const makeStyles = ([left, top, right, _bottom]) => ({ | ||
position: "absolute", | ||
position: 'absolute', | ||
left: left + (right - left) / 2, | ||
top: top, | ||
top, | ||
}) | ||
|
||
export const Detection = ({data}) => <div style={makeStyles(data.bbox)}> | ||
export const Detection = ({ data }) => <div style={makeStyles(data.bbox)}> | ||
{data.class} | ||
</div> | ||
|
||
Detection.propTypes = { data: PropTypes.object.isRequired } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
import React from "react"; | ||
import React from 'react' | ||
|
||
import {useContext} from "./context"; | ||
import {Detection} from "./detection"; | ||
import { useContext } from 'camera/context' | ||
import { Detection } from 'camera/detection' | ||
|
||
const styles = { | ||
position: 'absolute', | ||
color: 'yellow', | ||
fontWeight: 600, | ||
top: 0, | ||
left: 0 | ||
left: 0, | ||
} | ||
|
||
export const Detections = () => { | ||
const {objects} = useContext() | ||
const { objects } = useContext() | ||
|
||
return <div style={styles}> | ||
{ | ||
objects.map((item, index) => <Detection data={item} key={index}/>) | ||
objects.map((item, index) => <Detection data={item} key={index} />) | ||
} | ||
</div>; | ||
</div> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
import '@tensorflow/tfjs-backend-cpu'; | ||
import '@tensorflow/tfjs-backend-webgl'; | ||
import '@tensorflow/tfjs-backend-cpu' | ||
import '@tensorflow/tfjs-backend-webgl' | ||
|
||
import React from 'react'; | ||
import React from 'react' | ||
|
||
import {Behaviour} from "./behaviour"; | ||
import {Detections} from "./detections"; | ||
import {Context, useValue} from "./context"; | ||
import {Camera as CameraComponent} from "./camera"; | ||
import { Behaviour } from 'camera/behaviour' | ||
import { Detections } from 'camera/detections' | ||
import { useValue, Context } from 'camera/context' | ||
import { Camera as CameraComponent } from 'camera/camera' | ||
|
||
export const Camera = () => <Context.Provider value={useValue()}> | ||
<Behaviour/> | ||
<CameraComponent/> | ||
<Detections/> | ||
<Behaviour /> | ||
<CameraComponent /> | ||
<Detections /> | ||
</Context.Provider> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
import {from, fromEvent} from "rxjs"; | ||
import {load} from "@tensorflow-models/coco-ssd"; | ||
import { from, fromEvent } from 'rxjs' | ||
import { load } from '@tensorflow-models/coco-ssd' | ||
|
||
const camera = ref => fromEvent(ref.current.video, 'play') | ||
|
||
const model = () => from(load({base: "mobilenet_v2"})) | ||
const model = () => from(load({ base: 'mobilenet_v2' })) | ||
|
||
export const repository = { | ||
camera, | ||
model | ||
model, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,15 @@ | ||
import {useContext} from "./context"; | ||
import {from, of} from "rxjs"; | ||
import {delay, mergeMap, repeat, tap} from "rxjs/operators"; | ||
import {useCallback} from "react"; | ||
import { from, of } from 'rxjs' | ||
import { useCallback } from 'react' | ||
import { delay, mergeMap, repeat, tap } from 'rxjs/operators' | ||
|
||
import { useContext } from 'camera/context' | ||
|
||
export const useCoroutine = () => { | ||
const {camera, setObjects} = useContext() | ||
const { camera, setObjects } = useContext() | ||
|
||
return useCallback(model => of({}) | ||
.pipe(mergeMap(() => from(model.detect(camera.current.video)))) | ||
.pipe(tap(setObjects)) | ||
.pipe(delay(1000)) | ||
.pipe(repeat()), []) | ||
.pipe(repeat()), [camera, setObjects]) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
import {useEffect} from "react"; | ||
import {combineLatest} from "rxjs"; | ||
import {mergeMap, map, tap} from "rxjs/operators"; | ||
import { useEffect } from 'react' | ||
import { combineLatest } from 'rxjs' | ||
import { mergeMap, map } from 'rxjs/operators' | ||
|
||
import {useContext} from "./context"; | ||
import {repository} from "./repository"; | ||
import {useCoroutine} from "./use-coroutine"; | ||
import { useContext } from 'camera/context' | ||
import { repository } from 'camera/repository' | ||
import { useCoroutine } from 'camera/use-coroutine' | ||
|
||
const makeSubscription = params => combineLatest([repository.camera(params.camera), repository.model()]) | ||
.pipe(map(([_, model]) => model)) | ||
.pipe(mergeMap(params.startPrediction)) | ||
.subscribe() | ||
|
||
export const usePrediction = () => { | ||
const {camera} = useContext() | ||
const { camera } = useContext() | ||
const startPrediction = useCoroutine() | ||
|
||
useEffect(() => { | ||
const subscription = makeSubscription({camera, startPrediction}) | ||
const subscription = makeSubscription({ camera, startPrediction }) | ||
|
||
return () => subscription.unsubscribe() | ||
}, []) | ||
}, [camera, startPrediction]) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,14 @@ | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import React from 'react' | ||
import ReactDOM from 'react-dom' | ||
|
||
import {Startup} from "./startup"; | ||
import reportWebVitals from './reportWebVitals'; | ||
import * as serviceWorkerRegistration from './serviceWorkerRegistration'; | ||
import { Startup } from 'startup' | ||
import reportWebVitals from 'reportWebVitals' | ||
import * as serviceWorkerRegistration from 'serviceWorkerRegistration' | ||
|
||
ReactDOM.render( | ||
<React.StrictMode> | ||
<Startup /> | ||
</React.StrictMode>, | ||
document.getElementById('root') | ||
); | ||
ReactDOM.render(<React.StrictMode> | ||
<Startup /> | ||
</React.StrictMode>, document.getElementById('root')) | ||
|
||
serviceWorkerRegistration.unregister(); | ||
serviceWorkerRegistration.unregister() | ||
|
||
reportWebVitals(); | ||
reportWebVitals() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import {useSelector} from "react-redux"; | ||
import { useSelector } from 'react-redux' | ||
|
||
export const useShouldShow = () => useSelector(state => state.loading.length) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,5 +18,5 @@ export const style = { | |
|
||
background: 'white', | ||
zIndex: 99999, | ||
fontWeight: 600 | ||
fontWeight: 600, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
const reportWebVitals = (onPerfEntry) => { | ||
const reportWebVitals = onPerfEntry => { | ||
if (onPerfEntry && onPerfEntry instanceof Function) { | ||
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { | ||
getCLS(onPerfEntry); | ||
getFID(onPerfEntry); | ||
getFCP(onPerfEntry); | ||
getLCP(onPerfEntry); | ||
getTTFB(onPerfEntry); | ||
}); | ||
getCLS(onPerfEntry) | ||
getFID(onPerfEntry) | ||
getFCP(onPerfEntry) | ||
getLCP(onPerfEntry) | ||
getTTFB(onPerfEntry) | ||
}) | ||
} | ||
}; | ||
} | ||
|
||
export default reportWebVitals; | ||
export default reportWebVitals |
Oops, something went wrong.