summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2018-09-13 18:58:43 +0200
committerJules Laplace <julescarbon@gmail.com>2018-09-13 18:58:43 +0200
commitf987d163754044f6dc032325766f4c6c7e1dc401 (patch)
treeb9861a75144665f6f8cf3e4e4301dbce0ab0dafc
parent908e0644bacad5850798c52c1c050f5f733040a2 (diff)
paths
-rwxr-xr-xaugment.py5
-rwxr-xr-xdir-to-movie.pl21
-rw-r--r--options/dataset_options.py6
3 files changed, 24 insertions, 8 deletions
diff --git a/augment.py b/augment.py
index 4aab5f1..1b32483 100755
--- a/augment.py
+++ b/augment.py
@@ -153,6 +153,9 @@ for m in range(data_opt.augment_take):
image_pil.save(tmp_path)
os.rename(tmp_path, next_path)
+ if data_opt.no_symlink:
+ continue
+
frame_A = os.path.join("./datasets/", data_opt.sequence_name, "train_A", "recur_{}_{:05d}_{:05d}.png".format(epoch_id, m, index+1))
frame_B = os.path.join("./datasets/", data_opt.sequence_name, "train_B", "recur_{}_{:05d}_{:05d}.png".format(epoch_id, m, index+1))
if os.path.exists(frame_A):
@@ -161,5 +164,3 @@ for m in range(data_opt.augment_take):
os.unlink(frame_B)
os.symlink(os.path.abspath(next_path), os.path.abspath(frame_A))
os.symlink(os.path.abspath(sequence[index+2]), os.path.abspath(frame_B))
-
-
diff --git a/dir-to-movie.pl b/dir-to-movie.pl
index 4efeb7e..718e7ff 100755
--- a/dir-to-movie.pl
+++ b/dir-to-movie.pl
@@ -8,11 +8,13 @@ STDOUT->autoflush(1);
my $tag = "pix2pixhd_" . time;
my $module = "pix2pixhd";
+my $path = "results";
my $endpoint = undef;
my $prefix = "ren";
GetOptions (
"tag=s" => \$tag,
"module=s" => \$module,
+ "path=s" => \$path,
"endpoint=s" => \$endpoint,
"prefix=s" => \$prefix,
)
@@ -24,12 +26,12 @@ print "tag: $tag\n";
print "module: $module\n";
print "endpoint: $endpoint\n";
-if (! -e "results/$tag") {
+if (! -e "$path/$tag") {
print "usage: $0 [tag]\n";
exit(1);
}
-chdir("results/$tag");
+chdir("$path/$tag");
print `pwd`;
my $i = 0;
@@ -56,7 +58,14 @@ if ($i == 0) {
exit(1);
}
-my $ffmpeg = `ffmpeg -i ./tmp/frame_%05d.png -y -c:v libx264 -vf fps=25 -pix_fmt yuv420p -s 1024x512 ../../renders/$tag.mp4`;
+my $parent_dir = "../..";
+
+if ($tag =~ /\//) {
+ $parent_dir .= "/..";
+ $tag =~ s/\//_/g;
+}
+
+my $ffmpeg = `ffmpeg -i ./tmp/frame_%05d.png -y -c:v libx264 -vf fps=25 -pix_fmt yuv420p -s 1024x512 $parent_dir/$path/$tag.mp4`;
my @lines = split("\n", $ffmpeg);
for my $line (@lines) {
@@ -71,7 +80,7 @@ if (defined $endpoint) {
"-F", "generated=true",
"-F", "dataset=$tag",
"-F", "datatype=video",
- "-F", "file=@../../renders/$tag.mp4",
+ "-F", "file=@$parent_dir/renders/$tag.mp4",
$endpoint
);
}
@@ -79,6 +88,6 @@ if (defined $endpoint) {
print "rendered: $tag.mp4\n";
END {
- system('rm', '-rf', 'tmp');
- chdir('../..');
+ system('rm', '-rf', './tmp');
+ chdir($parent_dir);
}
diff --git a/options/dataset_options.py b/options/dataset_options.py
index 93fbb6d..b499206 100644
--- a/options/dataset_options.py
+++ b/options/dataset_options.py
@@ -315,6 +315,12 @@ class DatasetOptions(BaseOptions):
help='name to tag epoch'
)
+ self.parser.add_argument(
+ '--no-symlink',
+ action='store_true',
+ help='dont symlink the augmented frames into the dataset'
+ )
+
### GRAYSCALE
self.parser.add_argument(