diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2018-11-25 22:19:15 +0100 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2018-11-25 22:19:15 +0100 |
| commit | ee3d0d98e19f1d8177d85af1866fd0ee431fe9ea (patch) | |
| tree | 41372528e78d4328bc2a47bbbabac7e809c58894 /client/common/classifier.component.js | |
| parent | 255b8178af1e25a71fd23703d30c0d1f74911f47 (diff) | |
moving stuff
Diffstat (limited to 'client/common/classifier.component.js')
| -rw-r--r-- | client/common/classifier.component.js | 99 |
1 files changed, 0 insertions, 99 deletions
diff --git a/client/common/classifier.component.js b/client/common/classifier.component.js deleted file mode 100644 index af6a4934..00000000 --- a/client/common/classifier.component.js +++ /dev/null @@ -1,99 +0,0 @@ -import React, { Component } from 'react' -import { courtesyS } from '../util' - -import { TableTuples, DetectionList, Keyframe } from '.' - -export default class Classifier extends Component { - render() { - const { - tag, - sha256, - verified, - keyframes = {}, - labels, - summary, - aspectRatio = 1.777, - showAll, - } = this.props - let totalDetections = 0 - const keys = Object - .keys(keyframes) - .map(s => parseInt(s, 10)) - const validKeyframes = keys - .sort((a, b) => a - b) - .map(frame => { - const detections = keyframes[frame] - if (detections.length || showAll) { - totalDetections += detections.length - return { frame, detections } - } - return null - }) - .filter(f => !!f) - const detectionLookup = validKeyframes - .reduce((a, b) => { - b.detections.reduce((aa, { idx }) => { - if (!(idx in aa)) aa[idx] = [labels[idx], 0] - aa[idx][1] += 1 - return aa - }, a) - return a - }, {}) - const detectionCounts = Object.keys(detectionLookup) - .map(idx => detectionLookup[idx]) - .sort((a, b) => b[1] - a[1]) - - if (summary) { - return ( - <div> - <h3>{tag}{' Detections'}</h3> - <TableTuples - list={detectionCounts} - /> - </div> - ) - } - return ( - <div> - <h2>{tag}</h2> - <h3>Detections</h3> - <TableTuples - list={detectionCounts} - /> - <h3>Frames</h3> - <ul className='meta'> - <li> - {'Displaying '}{validKeyframes.length}{' / '}{courtesyS(keys.length, 'frame')} - </li> - <li> - {courtesyS(totalDetections, 'detection')}{' found'} - </li> - </ul> - <div className='thumbnails'> - {validKeyframes.map(({ frame, detections }) => ( - <Keyframe - key={frame} - sha256={sha256} - frame={frame} - verified={verified} - size='th' - showFrame - showTimestamp - aspectRatio={aspectRatio} - detectionList={[ - { labels, detections } - ]} - > - <DetectionList - labels={labels} - detections={detections} - width={160} - height={90} - /> - </Keyframe> - ))} - </div> - </div> - ) - } -} |
