Skip to content

Commit

Permalink
adding call to neural_style.lua
Browse files Browse the repository at this point in the history
  • Loading branch information
mbartoli committed Sep 2, 2015
1 parent 074a0a7 commit 46dd1f6
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 109 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -3,3 +3,4 @@ processed_frames/*
original-*
original_*
2_*
paint.py~
43 changes: 20 additions & 23 deletions paint.py
Expand Up @@ -19,7 +19,7 @@ def make_sure_path_exists(path):
if exception.errno != errno.EEXIST:
raise

def main(input, output, image_type, style):
def main(input, output, style):
make_sure_path_exists(input)
make_sure_path_exists(output)

Expand All @@ -37,26 +37,27 @@ def main(input, output, image_type, style):
else:
nrframes = nrframes+1

for i in xrange(frame_i, nrframes):
print('Processing frame #{}').format(frame_i)

os.system("th neural_style.lua -style_image " + style + " -content_image " + input + "/%08d.jpg" % frame_i)

saveframe = output + "/%08d.%s" % (frame_i, image_type)

saveframe = output + "/%08d.%s" % (frame_i, image_type)
later = time.time()
difference = int(later - now)
totaltime += difference
avgtime = (totaltime / i)


# stats
later = time.time()
difference = int(later - now)
totaltime += difference
avgtime = (totaltime / i)

print '***************************************'
print 'Saving Image As: ' + saveframe
print 'Frame ' + str(i) + ' of ' + str(nrframes-1)
print 'Frame Time: ' + str(difference) + 's'
timeleft = avgtime * ((nrframes-1) - frame_i)
m, s = divmod(timeleft, 60)
h, m = divmod(m, 60)
print 'Estimated Total Time Remaining: ' + str(timeleft) + 's (' + "%d:%02d:%02d" % (h, m, s) + ')'
print '***************************************'
print '***************************************'
print 'Saving Image As: ' + saveframe
print 'Frame ' + str(i) + ' of ' + str(nrframes-1)
print 'Frame Time: ' + str(difference) + 's'
timeleft = avgtime * ((nrframes-1) - frame_i)
m, s = divmod(timeleft, 60)
h, m = divmod(m, 60)
print 'Estimated Total Time Remaining: ' + str(timeleft) + 's (' + "%d:%02d:%02d" % (h, m, s) + ')'
print '***************************************'



Expand All @@ -72,15 +73,11 @@ def main(input, output, image_type, style):
'-o','--output',
help='Output directory where processed frames are to be stored',
required=True)
parser.add_argument(
'-it','--image_type',
help='Specify whether jpg or png',
required=True)
parser.add_argument(
'-s','--style',
help='Image to base the style after',
required=True)

args = parser.parse_args()

main(args.input, args.output, args.image_type, args.style)
main(args.input, args.output, args.style)
86 changes: 0 additions & 86 deletions paint.py~

This file was deleted.

0 comments on commit 46dd1f6

Please sign in to comment.