summaryrefslogtreecommitdiff
path: root/app/client/modules/pix2pixhd
diff options
context:
space:
mode:
authorJules <jules@asdf.us>2018-06-20 12:29:36 -0400
committerJules <jules@asdf.us>2018-06-20 12:29:36 -0400
commit89c3c2546af95122099e5e3e7cc0c40448066508 (patch)
tree226bcc92ebbfab003339ffbd346a90421d9c6fe0 /app/client/modules/pix2pixhd
parent95de035728c209a6d0acee9b14a86837e44d26e4 (diff)
parent78abe1dc85c7b251cc871ffd4630a4a6c5eb2bd4 (diff)
oop
Diffstat (limited to 'app/client/modules/pix2pixhd')
-rw-r--r--app/client/modules/pix2pixhd/pix2pixhd.actions.js31
-rw-r--r--app/client/modules/pix2pixhd/pix2pixhd.reducer.js6
-rw-r--r--app/client/modules/pix2pixhd/pix2pixhd.tasks.js6
-rw-r--r--app/client/modules/pix2pixhd/views/pix2pixhd.live.js57
-rw-r--r--app/client/modules/pix2pixhd/views/pix2pixhd.results.js62
-rw-r--r--app/client/modules/pix2pixhd/views/pix2pixhd.show.js1
6 files changed, 113 insertions, 50 deletions
diff --git a/app/client/modules/pix2pixhd/pix2pixhd.actions.js b/app/client/modules/pix2pixhd/pix2pixhd.actions.js
index 1ee4886..370597b 100644
--- a/app/client/modules/pix2pixhd/pix2pixhd.actions.js
+++ b/app/client/modules/pix2pixhd/pix2pixhd.actions.js
@@ -31,15 +31,16 @@ export const load_directories = (id) => (dispatch) => {
folders,
files,
unsortedFolder,
+ resultsFolder,
} = datasetApiReport
// console.log(datasetUsage)
const sequenceDirectories = sequences.filter(s => s.dir)
- console.log(sequenceDirectories)
+ // console.log(sequenceDirectories)
sequenceDirectories.forEach(dir => {
const dataset = datasetLoader.getDataset(module, datasetLookup, dir.name)
dataset.isBuilt = true
- console.log(dir.name, dataset)
+ // console.log(dir.name, dataset)
})
datasets.filter(s => s.dir).forEach(dir => {
@@ -119,6 +120,7 @@ export const load_directories = (id) => (dispatch) => {
sequences: sequenceDirectories,
datasets,
checkpoints: checkpointDirectories,
+ resultsFolder,
},
})
if (id) {
@@ -135,3 +137,28 @@ export const load_directories = (id) => (dispatch) => {
console.error(e)
})
}
+
+export const load_results = (id) => (dispatch) => {
+ const module = pix2pixhdModule.name
+ util.allProgress([
+ actions.folder.index({ name: 'results' }),
+ actions.file.index({ module, generated: 1 }),
+ actions.socket.list_sequences({ module, dir: 'results' }),
+ actions.socket.list_directory({ module, dir: 'renders' }),
+ ], (percent, i, n) => {
+ console.log('pix2pixhd load progress', i, n)
+ dispatch({ type: types.app.load_progress, progress: { i, n }})
+ }).then(res => {
+ const [folders, files, results, renders] = res //, datasets, results, output, datasetUsage, lossReport] = res
+ console.log(files, results, renders)
+ dispatch({
+ type: types.pix2pixhd.load_results,
+ results: {
+ resultsFolder: folders[0],
+ files,
+ results,
+ renders,
+ }
+ })
+ })
+} \ No newline at end of file
diff --git a/app/client/modules/pix2pixhd/pix2pixhd.reducer.js b/app/client/modules/pix2pixhd/pix2pixhd.reducer.js
index a21f4d5..b6264ed 100644
--- a/app/client/modules/pix2pixhd/pix2pixhd.reducer.js
+++ b/app/client/modules/pix2pixhd/pix2pixhd.reducer.js
@@ -7,6 +7,7 @@ const pix2pixhdInitialState = {
error: null,
folder_id: 0,
data: null,
+ results: null,
}
const pix2pixhdReducer = (state = pix2pixhdInitialState, action) => {
@@ -15,6 +16,11 @@ const pix2pixhdReducer = (state = pix2pixhdInitialState, action) => {
}
switch (action.type) {
+ case types.pix2pixhd.load_results:
+ return {
+ ...state,
+ results: action.results,
+ }
default:
return state
}
diff --git a/app/client/modules/pix2pixhd/pix2pixhd.tasks.js b/app/client/modules/pix2pixhd/pix2pixhd.tasks.js
index 2e7cbbd..f3c5342 100644
--- a/app/client/modules/pix2pixhd/pix2pixhd.tasks.js
+++ b/app/client/modules/pix2pixhd/pix2pixhd.tasks.js
@@ -31,21 +31,21 @@ export const train_task = (dataset, folder_id, epochs=1) => dispatch => {
epochs: epochs,
opt: {
folder_id: folder_id,
- load_size: 264, // switch to 256 for pix2wav
}
}
console.log(task)
return actions.queue.add_task(task)
}
-export const live_task = (sequence, checkpoint) => dispatch => {
+export const live_task = (sequence, checkpoint, opt) => dispatch => {
const task = {
module: module.name,
activity: 'live',
dataset: sequence,
checkpoint,
opt: {
- poll_delay: 0.09,
+ ...opt,
+ poll_delay: 0.01,
}
}
console.log(task)
diff --git a/app/client/modules/pix2pixhd/views/pix2pixhd.live.js b/app/client/modules/pix2pixhd/views/pix2pixhd.live.js
index 3f027a1..0bdcefe 100644
--- a/app/client/modules/pix2pixhd/views/pix2pixhd.live.js
+++ b/app/client/modules/pix2pixhd/views/pix2pixhd.live.js
@@ -4,7 +4,7 @@ import { connect } from 'react-redux'
import {
ParamGroup, Param, Player,
- Slider, Select, Button, Loading
+ Slider, Select, TextInput, Button, Loading
} from '../../../common/'
import { startRecording, stopRecording, saveFrame, toggleFPS } from '../../../live/player'
@@ -51,11 +51,13 @@ class Pix2PixHDLive extends Component {
this.props.actions.live.seek(frame)
}
start(){
- // console.log(this.props)
- const sequence = this.props.pix2pixhd.data.sequences[0].name
- const checkpoint = this.props.pix2pixhd.data.checkpoints[0].name
+ console.log(this.props.opt)
+ const sequence = this.props.opt.sequence_name || this.props.pix2pixhd.data.sequences[0].name
+ const checkpoint = this.props.opt.checkpoint_name || this.props.pix2pixhd.data.checkpoints[0].name
console.log('starting up!', sequence, checkpoint)
- this.props.actions.tasks.live_task(sequence, checkpoint)
+ this.props.actions.tasks.live_task(sequence, checkpoint, {
+ folder_id: this.props.pix2pixhd.data.resultsFolder.id,
+ })
}
interrupt(){
this.props.actions.queue.stop_task('gpu')
@@ -121,21 +123,10 @@ class Pix2PixHDLive extends Component {
/>
<Slider live
name='frame_delay'
- min={0.05} max={2.0} type='float'
+ min={0.0} max={2.0} type='float'
/>
{this.renderRestartButton()}
- <Button
- title={
- this.props.opt.savingVideo
- ? 'Saving video...'
- : this.props.opt.recording
- ? 'Recording (' + timeInSeconds(this.props.opt.recordFrames/25) +')'
- : 'Record video'
- }
- onClick={this.toggleRecording}
- >
- {this.props.opt.savingVideo ? 'Saving' : this.props.opt.recording ? 'Recording' : 'Record'}
- </Button>
+ {this.renderRecordButton()}
<Button
title={'Save frame'}
onClick={saveFrame}
@@ -143,12 +134,20 @@ class Pix2PixHDLive extends Component {
Save
</Button>
<ParamGroup
- title='Render on server'
+ title='Record video'
name='store_b'
onToggle={(value) => {
// now storing frames on server...
}}
>
+ <TextInput
+ title='Video name'
+ name='final_tag'
+ value={this.props.opt.final_tag}
+ onSave={value => {
+ this.props.actions.live.set_param('final_tag', value)
+ }}
+ />
</ParamGroup>
<p class='last_message'>{this.props.last_message}</p>
@@ -197,7 +196,7 @@ class Pix2PixHDLive extends Component {
>
<Slider live
name='sequence_frac'
- min={0.0} max={0.5} type='float'
+ min={0.0} max={1.0} type='float'
/>
<Slider live
name='process_frac'
@@ -264,6 +263,7 @@ class Pix2PixHDLive extends Component {
)
}
renderRestartButton(){
+ console.log(this.props.runner.gpu)
if (this.props.runner.gpu.status === 'IDLE') {
return (
<Button
@@ -307,6 +307,23 @@ class Pix2PixHDLive extends Component {
</div>
)
}
+ renderRecordButton(){
+ return null
+ // return (
+ // <Button
+ // title={
+ // this.props.opt.savingVideo
+ // ? 'Saving video...'
+ // : this.props.opt.recording
+ // ? 'Recording (' + timeInSeconds(this.props.opt.recordFrames/25) +')'
+ // : 'Record video'
+ // }
+ // onClick={this.toggleRecording}
+ // >
+ // {this.props.opt.savingVideo ? 'Saving' : this.props.opt.recording ? 'Recording' : 'Record'}
+ // </Button>
+ // )
+ }
}
function timeInSeconds(n){
return n.toFixed(1) + ' s.'
diff --git a/app/client/modules/pix2pixhd/views/pix2pixhd.results.js b/app/client/modules/pix2pixhd/views/pix2pixhd.results.js
index dcbbfad..aa4d6af 100644
--- a/app/client/modules/pix2pixhd/views/pix2pixhd.results.js
+++ b/app/client/modules/pix2pixhd/views/pix2pixhd.results.js
@@ -13,33 +13,13 @@ import { FileList, FileRow } from '../../../common/fileList.component'
class Pix2pixHDResults extends Component {
constructor(props){
super()
- // if (!props.pix2pixhd.data) props.actions.load_directories()
+ if (!props.pix2pixhd.results) props.actions.load_results()
}
render(){
- if (this.props.pix2pixhd.loading) return <Loading progress={this.props.pix2pixhd.progress} />
- // const { folderLookup, fileLookup, datasetLookup } = this.props.samplernn.data
+ if (! this.props.pix2pixhd.results) return <Loading progress={this.props.pix2pixhd.progress} />
- // console.log(bestRenders.map(r => r.epoch))
- // const path = folder.name === 'unsorted'
- // ? "/samplernn/import/"
- // : "/samplernn/datasets/" + folder.id + "/"
- // return (
- // <div className='col bestRenders'>
- // <h3><Link to={path}>{folder.name}</Link></h3>
- // <FileList
- // linkFiles
- // files={bestRenders}
- // orderBy='date desc'
- // fields={'name date epoch size'}
- // onClick={(file, e) => {
- // e.preventDefault()
- // e.stopPropagation()
- // console.log('picked a file', file)
- // this.handlePick(file)
- // }}
- // />
- // </div>
- // )
+ const { resultsFolder, results, renders, files } = this.props.pix2pixhd.results
+ console.log(resultsFolder, results)
return (
<div className='app pix2pixhd'>
@@ -47,6 +27,40 @@ class Pix2pixHDResults extends Component {
<h1>Pix2PixHD Results</h1>
</div>
<div class='rows params renders'>
+
+ <FileList
+ linkFiles
+ files={files}
+ orderBy='date desc'
+ fields={'name date size'}
+ />
+
+ <h3>renders</h3>
+ <FileList
+ files={renders}
+ orderBy='date desc'
+ fields={'name date size'}
+ onClick={(file, e) => {
+ e.preventDefault()
+ e.stopPropagation()
+ console.log('picked a result', file)
+ this.handlePick(file)
+ }}
+ />
+
+ <h3>results</h3>
+ <FileList
+ files={results}
+ orderBy='date desc'
+ fields={'name date count'}
+ onClick={(file, e) => {
+ e.preventDefault()
+ e.stopPropagation()
+ console.log('picked a result', file)
+ this.handlePick(file)
+ }}
+ />
+
</div>
</div>
)
diff --git a/app/client/modules/pix2pixhd/views/pix2pixhd.show.js b/app/client/modules/pix2pixhd/views/pix2pixhd.show.js
index 5777ac0..d58ee80 100644
--- a/app/client/modules/pix2pixhd/views/pix2pixhd.show.js
+++ b/app/client/modules/pix2pixhd/views/pix2pixhd.show.js
@@ -86,7 +86,6 @@ class Pix2PixHDShow extends Component {
const input = pix2pixhd.data.fileLookup[dataset.input[0]]
if (! input) return null
if (input.name && input.name.match(/(gif|jpe?g|png)$/i)) return null
- console.log(dataset)
return (
<div>
<div class={'actions'}>