LocalForge AILocalForge AI
LibraryBlogFAQ

How to Clean a LoRA Training Dataset

Cleaning a LoRA training dataset means removing evidence you do not want the adapter to learn. That includes obvious problems such as watermarks, broken anatomy, heavy compression, and accidental borders. It also includes less visible problems: inconsistent identity, restoration artifacts, misleading crops, repeated accessories, private information, and images you do not have the right to use.

The goal is not to make every file glossy or identical. Aggressive face restoration, denoising, sharpening, background removal, and color correction can replace natural detail with one repeated processing signature. Clean conservatively. Keep the concept accurate, preserve useful variation, and reject a source when repair would require inventing important pixels. This workflow covers visual and semantic cleanup from candidate collection through an approved set. Duplicate detection, folder conventions, image-size selection, and the final cross-file audit have their own focused guides.

Quick Answer

Make a copy of candidate files, define what the LoRA should learn, and review every image at contact-sheet scale and at 100 percent zoom. Reject files with wrong identity, structural defects, unreadable concept details, watermarks, severe compression, unwanted text, or unclear usage rights. Repair only simple, local distractions when the correction does not invent concept evidence.

Keep a rejection log. After visual cleanup, inspect the remaining set for accidental correlations such as one outfit, background, camera angle, or color appearing too often. Cleaning is complete when every retained image is accurate, useful, lawful to use, and consistent with the written training goal.

Write the Acceptance Rule First

A clean dataset is defined by a training target, not by generic image beauty. Write one sentence:

Teach [concept] while keeping [details] controllable.

Examples:

  • Teach a person's identity while keeping clothing, expression, pose, and setting controllable.
  • Teach a product's shape and markings while keeping surface, scene, and viewpoint controllable.
  • Teach a watercolor treatment while keeping subject matter, composition, and palette controllable.

This rule tells you whether a visible feature is core evidence, useful variation, a captionable detail, or contamination.

Do not clean toward an undefined goal such as "make the dataset better." That encourages arbitrary filters and edits that may remove the variation the LoRA needs.

Protect Originals

Never clean files in place. Keep originals read-only and work on copies. Preserve source names or a manifest so each processed image can be traced back.

A useful review record includes:

  • Original filename.
  • Candidate ID.
  • Keep, repair, or reject decision.
  • Reason for the decision.
  • Edit applied.
  • Rights or permission note.

This record prevents the same weak image from returning in a later collection pass. It also exposes whether too many files require the same repair, which often signals a bad source rather than isolated defects.

Pass 1: Contact-Sheet Review

Start with a grid of all candidates. Do not zoom in yet. A contact sheet reveals collection-level problems that are difficult to see one file at a time.

Look for:

  • A single background dominating the set.
  • The same outfit or accessory in most subject images.
  • One camera angle or crop repeated excessively.
  • Large changes in identity, product shape, or style.
  • Strong differences in color treatment or image generation pipeline.
  • Frames that are obvious copies or burst variants.
  • Images where the concept is tiny or hidden.

Mark suspicious files. Handle exact and near-duplicate analysis in a dedicated pass, but remove obvious redundant frames early so they do not influence later judgments.

Pass 2: Identity and Concept Accuracy

Open each candidate large enough to inspect the features the adapter must learn.

For a person or character, check:

  • Face shape, eye placement, hairline, and distinctive features.
  • Hand, limb, and body structure.
  • Stable marks, tattoos, ears, horns, or accessories that define the design.
  • Whether age and proportions remain plausible and consistent.

For a product or object, check:

  • Silhouette and proportions.
  • Number and placement of components.
  • Logos, labels, fasteners, controls, and material boundaries.
  • Reflections that falsely change geometry.

For a style, check:

  • Whether the visual treatment truly belongs to the target style.
  • Whether a source carries another strong artist, renderer, or medium signature.
  • Whether subject matter is being confused with style.

Reject images that contradict the concept. A sharp image of the wrong product revision or an inconsistent generated face is not useful variety.

Pass 3: Technical Defects

Inspect at 100 percent zoom. Reject or repair:

  • Severe JPEG blocking around important edges.
  • Motion blur or missed focus over defining features.
  • Banding, posterization, or crushed shadows that hide structure.
  • Broken alpha channels or unexpected transparency.
  • Corrupted files, partial decodes, or wrong color orientation.
  • Excessive sharpening halos.
  • Denoising that turns skin, fabric, or surfaces into wax.
  • Upscaling patterns that repeat across the image.

Minor noise is often less dangerous than aggressive cleanup. Natural camera noise varies. A strong denoiser can stamp the same plastic texture onto every file.

Verify that each file decodes fully in the software used for preprocessing. A thumbnail preview does not prove the complete file is readable.

Pass 4: Generated-Image Defects

Synthetic candidates need structural review, even when they look polished at first glance.

Check for:

  • Extra or fused fingers.
  • Asymmetric eyes or jewelry that changes shape.
  • Hair merging into clothing or background.
  • Repeated teeth, buttons, seams, or product controls.
  • Text-like gibberish.
  • Impossible reflections and shadows.
  • Melted background objects.
  • Fine-detail noise that imitates texture without coherent structure.

A trainer does not know these are mistakes. If several images contain the same defect, the defect becomes correlated evidence.

Repair only when the defect is outside the concept and can be removed cleanly. Do not paint a new hand, face, logo, or defining object part and then treat it as verified ground truth unless you can confirm its accuracy.

Pass 5: Watermarks, Text, Borders, and Overlays

Watermarks and signatures are high-contrast repeated features. Remove the image when you lack permission to remove them or when cleanup damages nearby concept detail.

Also inspect:

  • Social media handles.
  • Subtitles and interface elements.
  • Dates, timestamps, and camera overlays.
  • Decorative frames.
  • Scanning borders and page shadows.
  • Letterboxing.
  • Collage seams.
  • Safety labels or text not intrinsic to the target object.

Text intrinsic to a product may be important concept evidence, but diffusion models often reproduce text unreliably. Decide whether exact markings belong to the target. Keep them accurate and varied in viewpoint, or exclude misleading partial text.

Cropping is usually safer than inpainting when the distraction is near an edge and the crop preserves all defining features.

Pass 6: Crop and Occlusion Quality

A crop is clean only if it supports the intended coverage.

Reject accidental crops that cut through:

  • The top of the head or a defining hairstyle.
  • Hands, feet, tails, wings, or accessories.
  • Product handles, corners, or labels.
  • Garment edges and construction details.

Deliberate close-ups can be useful when they add clear evidence. The distinction is whether the crop has a purpose and whether the overall dataset still contains complete views.

Occlusion can provide useful variation, but do not let masks, sunglasses, hair, hands, or props hide the same defining region repeatedly. For identity LoRAs, enough unobstructed references must remain.

Pass 7: Color and Processing Consistency

Do not force identical exposure or white balance across all images. Natural lighting variation protects prompt control. Correct only obvious capture or export errors.

Watch for:

  • One subset with a heavy color cast caused by bad scanning.
  • Mixed limited-range and full-range video frames.
  • HDR tone mapping that creates halos.
  • Repeated beauty filters.
  • Face restoration applied to only part of the set.
  • Background removal with identical edge fringes.

If a processing method is necessary, test it on a few images and compare at full size. Apply it consistently only when it improves accuracy without erasing real variation.

Pass 8: Privacy, Permission, and Provenance

Technical quality does not grant training rights. Confirm that you own the files or have permission and sufficient rights for the intended use.

Remove private or sensitive information:

  • Addresses and license plates.
  • Private documents and screens.
  • Bystanders who did not agree to the use.
  • Location metadata when it creates unnecessary risk.
  • Images involving minors unless the project has a clear lawful and appropriate basis.

Keep a source and permission note. Do not rely on "found online" as provenance. Public visibility is not the same as authorization to train or publish outputs.

Pass 9: Correlation Cleanup

After individual files pass, return to the contact sheet. The set can still be dirty at the collection level.

Count repeated incidental features:

  • Clothing.
  • Background.
  • Lighting setup.
  • Pose and expression.
  • Camera angle.
  • Color palette.
  • Props.

If a detail should remain controllable but dominates the set, add legitimate variety, remove redundant examples, or caption the visible detail consistently. Do not solve a collection imbalance by editing backgrounds out of every image unless transparent or isolated presentation is the actual target.

Repair or Reject

Repair is appropriate when:

  • A small edge crop removes a timestamp.
  • A minor dust spot sits in empty background.
  • Orientation metadata needs normalization.
  • A non-concept border can be removed without harming composition.

Reject is safer when:

  • Identity or geometry is wrong.
  • Important detail is blurred or compressed away.
  • A watermark overlaps the concept.
  • Restoration must invent defining pixels.
  • Rights are unclear.
  • The image adds no coverage value.

Time spent rescuing a weak source can exceed the value of finding a better one.

Freeze the Clean Set

Once review is complete:

  1. Export approved images from originals using documented settings.
  2. Generate a new contact sheet.
  3. Verify all files decode and dimensions are sensible.
  4. Save hashes and the keep or reject log.
  5. Move only approved assets into the final dataset directory.
  6. Make the clean set read-only or version it.

Caption review, pair validation, duplicate scanning, and final quality gates should run against this frozen set. If any file changes later, update its hash and rerun the relevant checks.

Common Cleaning Mistakes

Beautifying instead of preserving truth

Skin smoothing, eye enhancement, and sharpening can change identity and texture. Accuracy matters more than polish.

Keeping weak files to hit a number

Image count is not a target worth contaminating the concept for. A smaller accurate set is easier to diagnose.

Removing all natural variation

Uniform backgrounds and color can bind presentation to the concept. Clean defects, not useful diversity.

Trusting thumbnails

Compression, anatomy, and restoration artifacts often appear only at full size.

Forgetting rights

A technically perfect file with unclear permission is not an approved training asset.

Bottom Line

Cleaning is evidence control. Retain files that accurately support the written goal, reject files that contradict it, and repair only simple distractions that do not require invented concept detail.

Finish with a new contact sheet and a frozen approved set. That gives later duplicate, caption, folder, and quality checks a stable target.

What to Do Next

FAQ

What should I remove from a LoRA training dataset? +
Remove wrong identity, structural defects, severe blur or compression, watermarks, unwanted overlays, misleading crops, unclear-rights sources, and files that add no useful coverage.
Should I denoise every LoRA training image? +
No. Aggressive denoising can erase real texture and add a repeated processed look. Correct clear defects conservatively and preserve natural variation.
Can I use face restoration before LoRA training? +
Use it cautiously, if at all. Restoration can change identity details and invent texture. A better original source is safer when the face is not readable.
Should I remove backgrounds from LoRA images? +
Usually not by default. Varied real backgrounds help prevent one setting from binding to the concept. Remove a background only when isolation serves the specific training goal.
How do I decide whether to repair or reject an image? +
Repair a small local distraction only when the concept stays accurate. Reject the file when important pixels are missing, geometry is wrong, rights are unclear, or repair would invent defining evidence.