Advertisement
sxiii

Neural Networks (Prisma style) Video Processing Bash Script

Apr 29th, 2017
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.83 KB | None | 0 0
  1. #!/bin/sh
  2. # This script takes multiple png from its folder and processes them via neural style:
  3. # https://github.com/jcjohnson/neural-style
  4. # This WILL take long time
  5.  
  6. # PLEASE TOUCH THESE SETTINGS
  7.  
  8. si="source.jpg"  # Source image (style to take from)
  9. output=".png"    # Target extension
  10. folder="mars"    # Working folder
  11. be="clnn"        # Backend: clnn (opencl), cunn (cuda), nn (other)
  12. iter="1000"      # Number of iterations (100 on Radeon RX470 tooks 15~25 seconds approx, default 1000)
  13. directory="out"  # Result directory
  14.  
  15. # DO NOT TOUCH LOWER!
  16. x=$(ls $folder/*png | wc -l)
  17. mkdir $folder/$directory
  18. for (( i=1; i<=$x; i++ )); do
  19. lz=$(printf "%04d" $i)
  20. time th neural_style.lua -style_image $folder/$si -content_image $folder/output_$lz.png -backend $be -num_iterations $iter -output_image $folder/$directory/frame$lz$output
  21. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement