Add --invert_colors flag to fix inverted video output from certain models

- Replace unreliable auto-detection with explicit user control
- Add --invert_colors CLI argument
- Update SKILL.md documentation with usage example
parent daae1fe2
......@@ -535,7 +535,14 @@ Auto mode detects NSFW content automatically. For explicit requests:
python3 videogen --model <model> --prompt "<prompt>" --no_filter
```
### 5. Reproducibility
### 5. Color Inversion
Some models (particularly certain LoRA adapters) may produce inverted colors. Fix this with:
```bash
python3 videogen --model wan2_2_i2v_general_nsfw_lora --image input.png --prompt "..." --invert_colors
```
### 6. Reproducibility
Always capture and store the seed for reproducibility:
```bash
......
......@@ -10238,11 +10238,9 @@ def main(args):
# Convert from [-1, 1] to [0, 1]
frames = (frames + 1.0) / 2.0
# Check if colors appear inverted (mostly dark images mean inverted)
# Inverted images have mean > 0.5 when they should be < 0.5
mean_val = np.mean(frames)
if mean_val > 0.7: # Likely inverted
print(f" ⚠️ Detected inverted colors (mean={mean_val:.2f}), correcting...")
# Check if colors should be inverted (user-specified via --invert_colors)
if args.invert_colors:
print(f" 🎨 Inverting colors as requested (--invert_colors)...")
frames = 1.0 - frames
# Now convert from [0, 1] to [0, 255]
......@@ -10480,6 +10478,8 @@ List TTS voices:
help="Directory for output files (overrides --output path)")
parser.add_argument("--seed", type=int, default=-1)
parser.add_argument("--no_filter", action="store_true")
parser.add_argument("--invert_colors", action="store_true",
help="Invert video colors after generation (fixes inverted output from some models)")
parser.add_argument("--upscale", action="store_true")
parser.add_argument("--upscale_factor", type=float, default=2.0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment