This commit is contained in:
Matthew Deville 2026-04-23 14:28:19 +02:00
parent 3be68fcccf
commit ebdbe13f26
4 changed files with 24 additions and 17 deletions

View file

@ -70,7 +70,9 @@ struct Args {
#[show_image::main] #[show_image::main]
fn main() -> Result<(), Box<dyn Error>> { fn main() -> Result<(), Box<dyn Error>> {
fmt() fmt()
.with_env_filter(EnvFilter::try_from_default_env().unwrap_or_else(|_| EnvFilter::new("info"))) .with_env_filter(
EnvFilter::try_from_default_env().unwrap_or_else(|_| EnvFilter::new("info")),
)
.with_writer(std::io::stderr) .with_writer(std::io::stderr)
.init(); .init();
@ -113,8 +115,7 @@ fn main() -> Result<(), Box<dyn Error>> {
if debug { if debug {
debug_mode(&img, &result_rgba)?; debug_mode(&img, &result_rgba)?;
} } else {
if let Some(output_file) = output_file { if let Some(output_file) = output_file {
result_rgba.save(&output_file)?; result_rgba.save(&output_file)?;
info!(path = %output_file.display(), "Wrote output image to file"); info!(path = %output_file.display(), "Wrote output image to file");
@ -126,6 +127,7 @@ fn main() -> Result<(), Box<dyn Error>> {
stdout.write_all(&buffer.into_inner())?; stdout.write_all(&buffer.into_inner())?;
} }
} }
}
Command::Batch { Command::Batch {
input_directory, input_directory,
output_directory, output_directory,

View file

@ -68,7 +68,12 @@ fn download_file(url: &str, dest: &Path) -> Result<(), Box<dyn Error>> {
// Only emit every 10% to avoid log spam while still giving feedback. // Only emit every 10% to avoid log spam while still giving feedback.
if progress >= last_reported_pct + 10 { if progress >= last_reported_pct + 10 {
last_reported_pct = progress - (progress % 10); last_reported_pct = progress - (progress % 10);
debug!(percent = last_reported_pct, downloaded, total = total_size, "Download progress"); debug!(
percent = last_reported_pct,
downloaded,
total = total_size,
"Download progress"
);
} }
} }
} }

View file

@ -16,10 +16,7 @@ pub fn apply_mask(original: &DynamicImage, mask: &GrayImage) -> Result<RgbaImage
if mask_width != orig_width || mask_height != orig_height { if mask_width != orig_width || mask_height != orig_height {
debug!( debug!(
mask_width, mask_width,
mask_height, mask_height, orig_width, orig_height, "Resizing mask to match original image"
orig_width,
orig_height,
"Resizing mask to match original image"
); );
std::borrow::Cow::Owned(image::imageops::resize( std::borrow::Cow::Owned(image::imageops::resize(
mask, mask,

View file

@ -109,7 +109,10 @@ pub trait Session {
let preprocess_start = Instant::now(); let preprocess_start = Instant::now();
let input = self.normalize(img)?; let input = self.normalize(img)?;
debug!(elapsed_ms = preprocess_start.elapsed().as_millis() as u64, "Preprocessing complete"); debug!(
elapsed_ms = preprocess_start.elapsed().as_millis() as u64,
"Preprocessing complete"
);
let apply_sigmoid = self.apply_sigmoid(); let apply_sigmoid = self.apply_sigmoid();
let input_name = self.input_name().to_string(); let input_name = self.input_name().to_string();