Skip to content

Commit

Permalink
Now saving the task types into separate dirs. Renamed special to rotrev.
Browse files Browse the repository at this point in the history
  • Loading branch information
neoneye committed Dec 23, 2023
1 parent 774e6e5 commit 85f526c
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions rust_project/loda-rust-cli/src/arc/generate_dataset_simple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,13 @@ impl GenerateDataset {
assert!(save_dir.is_dir());

for dataset_item in &self.dataset_items {
let path: PathBuf = save_dir.join(&dataset_item.filename);
let task_type_dir: PathBuf = save_dir.join(&dataset_item.dirname);
if !task_type_dir.is_dir() {
fs::create_dir(&task_type_dir)?;
}
assert!(task_type_dir.is_dir());

let path: PathBuf = task_type_dir.join(&dataset_item.filename);
fs::write(&path, &dataset_item.json)?;
}
Ok(())
Expand Down Expand Up @@ -444,13 +450,13 @@ impl GenerateDataset {
}

let transformation_name: &str = match transformation {
TwoPixelSpecialTransformation::LandscapeOrientation => "land",
TwoPixelSpecialTransformation::PortraitOrientation => "port",
TwoPixelSpecialTransformation::MixedOrientation => "landport",
TwoPixelSpecialTransformation::LandscapeOrientation => "land_rotrev",
TwoPixelSpecialTransformation::PortraitOrientation => "port_rotrev",
TwoPixelSpecialTransformation::MixedOrientation => "landport_rotrev",
};

let color_pair_strings_joined: String = color_pair_strings.join("_");
let filename: String = format!("{}_special_{}.json", transformation_name, color_pair_strings_joined);
let filename: String = format!("{}_{}.json", transformation_name, color_pair_strings_joined);

let dataset_item: DatasetItem = DatasetItem {
json: export.to_string()?,
Expand Down

0 comments on commit 85f526c

Please sign in to comment.