nkolkin13 / STROTSS

Style Transfer by Relaxed Optimal Transport and Self-Similarity (CVPR 2019)
309 stars 39 forks source link

output path and file name #10

Closed HandsomeDevilv112 closed 4 years ago

HandsomeDevilv112 commented 4 years ago

My apologies, but I seem to have gone illiterate. How does a person take an image from one folder, put it through STROTSS, and have it reach the other side in a new folder, with the original file name? I've tried adjusting output_path through command line and in the code itself, but I'm just not getting my head around it.

HandsomeDevilv112 commented 4 years ago

I made a crude solution that is somewhere in the neighborhood of "bowling shoes ugly", and though I would very much like to know a more elegant answer I'm going to close this per the first part of this comment.

nkolkin13 commented 4 years ago

Hi Mr. Devil, Sorry that I forgot to respond to this. I'm sure there's a way to do what you describe in bash without modifying the code, but bash scripting isn't my forte, so I don't know off the top of my head. In python to do what you're interested in I'd make a wrapper that takes as arguments INPUT_FOLDER, OUTPUT_FOLDER, and STYLE_IMAGE. Use glob to get a list of files paths beneath the INPUT_FOLDER, then for each of the path strings that glob returns split the string on the last '/' to get the filename, concatenate this with OUTPUT_FOLDER to get the corresponding output path for each input file. Then call style transfer with these paths + the style image. I'm not sure if this is helpful or not, I'm sure your solution is already good. Sorry again for the very delayed reply. Best, Nick

HandsomeDevilv112 commented 4 years ago

Apology not necessary, but appreciated. Thank you responding at all, especially because my question isn't exactly related to the function of your code. Also, I'm grateful for you pointing me in the right direction to modify the code myself. If I get it worked out, I'll give you a buzz. My answer was to use a spreadsheet format and have a line for each image I want to process, with renaming/moving being handled by a second line. Slap all that into a bash file, and it looks to be working thus far. Thanks again, -Al (is a handsome devil)