# Dream Weaver Automation Scripts This directory contains Python automation scripts for the Dream Weaver interior restyling workflow. ## Scripts Overview ### 1. dreamweaver_batch_processor.py Main batch processing controller for automated image restyling. **Features:** - Directory monitoring for automatic job queueing - Automatic mask caching for improved performance - Queue management with status tracking - Support for all three processing phases - WebSocket integration with ComfyUI for real-time status **Usage:** ```bash # Process single image python dreamweaver_batch_processor.py --input image.jpg --style scandinavian_minimalist --phase 1 # Process all images in directory python dreamweaver_batch_processor.py --batch --style art_deco_luxe --phase 2 # Start directory monitoring mode python dreamweaver_batch_processor.py --monitor ``` ### 2. mask_preprocessor.py Utility for preprocessing and caching segmentation masks. **Features:** - Offline mask generation and caching - Mask refinement (grow, feather, invert) - Multi-region mask support (walls, floor, ceiling) - Batch preprocessing for entire directories - Cache management and statistics **Usage:** ```bash # Preprocess single image python mask_preprocessor.py --image image.jpg # Preprocess entire directory python mask_preprocessor.py --directory ../test_inputs/ # Show cache statistics python mask_preprocessor.py --stats # Clear all cached masks python mask_preprocessor.py --clear-cache # Custom mask parameters python mask_preprocessor.py --image image.jpg --grow 5 --feather 8 ``` ## Configuration Scripts use configuration from `CONFIG` dictionary in each file. Key settings: - `comfyui_server`: ComfyUI HTTP endpoint (default: http://localhost:8188) - `comfyui_ws`: ComfyUI WebSocket endpoint (default: ws://localhost:8188/ws) - `input_directory`: Default input images directory - `output_directory`: Generated images output directory - `cache_directory`: Mask cache storage location - `batch_size`: Number of images to process in batch (Phase 3) ## Integration with ComfyUI These scripts require ComfyUI to be running with the Dream Weaver workflows loaded. **Starting ComfyUI:** ```bash cd Project_Velocity/comfy_engine python main.py --fp16 --lowvram ``` **For Production (Dual RTX PRO 6000):** ```bash python main.py --bf16 --highvram --xformers --gpu-batch-size 8 ``` ## Workflow Files Scripts reference these workflow JSON files: - `workflows/dreamweaver_phase1_depth.json` - Single ControlNet (RTX 3080Ti) - `workflows/dreamweaver_phase2_multicontrol.json` - Multi-ControlNet (RTX 3080Ti) - `workflows/dreamweaver_phase3_batch.json` - Batch processing (Dual RTX PRO 6000) ## Style Templates Available style templates (located in `../prompts/`): - `scandinavian_minimalist` - Light, airy Nordic design - `art_deco_luxe` - Glamorous 1920s aesthetic - `cyberpunk_neon` - High-tech futuristic - `biophilic_organic` - Nature-connected sustainable - `japandi_fusion` - Japanese-Scandinavian blend ## Dependencies Install required packages: ```bash pip install -r ../requirements.txt ``` ## Logging Scripts output logs to: - Console (real-time) - `dreamweaver_batch.log` (file) Log level can be adjusted in script `logging.basicConfig()` calls. ## Hardware Requirements **Phase 1 & 2 (Development):** - NVIDIA RTX 3080Ti (12GB VRAM) - 32GB System RAM - SSD Storage **Phase 3 (Production):** - Dual NVIDIA RTX PRO 6000 Blackwell (96GB VRAM each) - 128GB System RAM - NVMe SSD Storage - NVLink enabled for GPU memory pooling ## API Reference ### ComfyUI Endpoints Used - `POST /prompt` - Submit workflow to queue - `GET /queue` - Get queue status - `WS /ws` - WebSocket for real-time updates ### Job Status Values - `pending` - Waiting in queue - `processing` - Currently generating - `completed` - Successfully finished - `failed` - Error occurred ## Troubleshooting **Connection Refused Error:** - Ensure ComfyUI is running - Check server URL in configuration - Verify firewall settings **Out of Memory:** - Reduce batch size - Lower resolution - Enable tiled VAE decoding **Mask Cache Issues:** - Clear cache: `python mask_preprocessor.py --clear-cache` - Check cache directory permissions - Verify available disk space ## Development To extend functionality: 1. Modify `BatchProcessor` class for new processing logic 2. Add new style templates in `../prompts/` 3. Update workflow JSON files for new ControlNet configurations ## Support For issues related to: - **Scripts**: Check logs in `dreamweaver_batch.log` - **ComfyUI**: Refer to ComfyUI documentation - **Workflows**: See technical specification in `../docs/DREAMWEAVER_TECHNICAL_SPEC.md`