Image-Text-to-Text
Transformers
Safetensors
English
qwen3_5
text-generation-inference
VisionGuardrail
JSON
image-classification
content-safety
content-moderation
multimodal
safety-classifier
guardrail
visual-safety
multimodal-content-filter
mmcf
v1.0
conversational
Run this model with HF Jobs
Run prithivMLmods/VisionGuardrail-4B on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs and TRL to fine-tune https://huggingface.co/prithivMLmods/VisionGuardrail-4B. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/prithivMLmods/VisionGuardrail-4B on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/prithivMLmods/VisionGuardrail-4B. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Quantize for lower memory use
Use HF Jobs to create a 4-bit version of https://huggingface.co/prithivMLmods/VisionGuardrail-4B. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
Instructions to use prithivMLmods/VisionGuardrail-4B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use prithivMLmods/VisionGuardrail-4B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="prithivMLmods/VisionGuardrail-4B") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("prithivMLmods/VisionGuardrail-4B") model = AutoModelForMultimodalLM.from_pretrained("prithivMLmods/VisionGuardrail-4B", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use prithivMLmods/VisionGuardrail-4B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "prithivMLmods/VisionGuardrail-4B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "prithivMLmods/VisionGuardrail-4B", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/prithivMLmods/VisionGuardrail-4B
- SGLang
How to use prithivMLmods/VisionGuardrail-4B with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "prithivMLmods/VisionGuardrail-4B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "prithivMLmods/VisionGuardrail-4B", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "prithivMLmods/VisionGuardrail-4B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "prithivMLmods/VisionGuardrail-4B", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use prithivMLmods/VisionGuardrail-4B with Docker Model Runner:
docker model run hf.co/prithivMLmods/VisionGuardrail-4B
Update README.md
Browse files1234567891011121314151617181920212223242526272829303132333435363738394018 unmodified lines59606162636465666768697071727374757677787980818283848544 unmodified lines1301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122 unmodified lines215216217218219220221222223<link href="https://fonts.googleapis.com/css2?family=Ubuntu:wght@300;400;500;700&display=swap" rel="stylesheet"><div style="font-family: 'Ubuntu', sans-serif; background-color: #000000; color: #FFFFFF; max-width: 900px; margin: 0 auto; padding: 40px; line-height: 1.6; border-radius: 8px;"><h1 style="font-weight: 700; border-bottom: 1px solid #333; padding-bottom: 15px; color: #FFFFFF;">VisionGuardrail-4B</h1><p><b>VisionGuardrail-4B</b> is a multimodal content-safety classifier based on <b>Qwen/Qwen3.5-4B</b> and trained on the <a href="https://huggingface.co/datasets/prithivMLmods/ImageShield-Guardrail-Pro" style="color: #FF4500; text-decoration: none;">ImageShield-Guardrail-Pro</a> content-safety guardrail dataset. The model is designed to classify visual content as <b>Safe</b> or <b>Unsafe</b>, with a particular focus on detecting <b>Not Safe for Work (NSFW) sensual content</b> and other potentially sensitive visual content. VisionGuardrail-4B excels at detecting <b>explicit and sensitive visual content</b>, with detailed analysis of <b>dress codes, clothing exposure, poses, framing, and different visual settings</b> to support conservative content-safety classification.</p><div style="border: 1px solid #333; border-radius: 4px; padding: 15px; margin: 20px 0; background-color: #050505; color: #FFFFFF;">This model is an experimental release and may generate unexpected behaviors or reasoning artifacts in certain scenarios. <b>This model is intended for research and content-safety classification only.</b> Any outputs generated by this model are the sole responsibility of the user. The authors and hosting platform disclaim all liability for generated content. Users must ensure safe, ethical, and lawful usage.</div><h2 style="font-weight: 700; border-bottom: 1px solid #333; padding-bottom: 10px; color: #FFFFFF;">Key Highlights</h2><div style="margin-bottom: 20px;"><div style="margin-bottom: 8px;"><span style="color: #FFFFFF;">+</span> <b>Qwen 3.5 Foundation</b>: Built on <b>Qwen/Qwen3.5-4B</b>.</div><div style="margin-bottom: 8px;"><span style="color: #FFFFFF;">+</span> <b>Multimodal Content Filter</b>: Designed for visual content-safety classification.</div><div style="margin-bottom: 8px;"><span style="color: #FFFFFF;">+</span> <b>ImageShield-Guardrail-Pro Training</b>: Fine-tuned on the <b>prithivMLmods/ImageShield-Guardrail-Pro</b> content-safety guardrail dataset.</div><div style="margin-bottom: 8px;"><span style="color: #FFFFFF;">+</span> <b>Safe / Unsafe Classification</b>: Classifies visual content as either <b>Safe</b> or <b>Unsafe</b>.</div><div style="margin-bottom: 8px;"><span style="color: #FFFFFF;">+</span> <b>NSFW Sensual Content Detection</b>: Focused on identifying potentially <b>Not Safe for Work (NSFW) sensual content</b> and related sensitive visual material.</div><div style="margin-bottom: 8px;"><span style="color: #FFFFFF;">+</span> <b>Explicit & Sensitive Content Detection</b>: Excels at identifying explicit, revealing, provocative, and otherwise potentially sensitive visual content.</div><div style="margin-bottom: 8px;"><span style="color: #FFFFFF;">+</span> <b>Dress-Code Analysis</b>: Performs detailed analysis of clothing, dress codes, exposure, and revealing garments.</div><div style="margin-bottom: 8px;"><span style="color: #FFFFFF;">+</span> <b>Pose Analysis</b>: Analyzes body poses, positioning, framing, and potentially suggestive presentation.</div><div style="margin-bottom: 8px;"><span style="color: #FFFFFF;">+</span> <b>Context & Setting Analysis</b>: Considers different visual settings and contextual cues when determining content safety.</div><div style="margin-bottom: 8px;"><span style="color: #FFFFFF;">+</span> <b>Zero-Tolerance Safety Classification</b>: Uses a conservative classification policy that favors safety when the content is ambiguous.</div><div style="margin-bottom: 8px;"><span style="color: #FFFFFF;">+</span> <b>Structured Output</b>: Produces a machine-readable JSON response containing a caption, classification, and reasoning.</div></div><h2 style="font-weight: 700; border-bottom: 1px solid #333; padding-bottom: 10px; color: #FFFFFF;">Standard Instruction</h2><details style="border: 1px solid #333; border-radius: 4px; padding: 15px; margin: 20px 0; background-color: #050505; color: #FFFFFF;"><summary style="cursor: pointer; font-weight: bold; font-size: 1.1em; outline: none;">Click to expand Standard Instruction</summary><div style="margin-top: 15px;"><div style="position: relative; margin-bottom: 20px;"><button style="position: absolute; top: 5px; right: 5px; background: #222; color: #fff; border: 1px solid #444; padding: 5px 10px; cursor: pointer; border-radius: 4px; z-index: 10;" onclick="copyCode(this)">Copy</button><pre style="background-color: #111111; border: 1px solid #333; border-radius: 4px; padding: 15px; overflow-x: auto; color: #FFFFFF; margin: 0;"><code>You are a strict, zero-tolerance parental control content-safety guardrail classifier for visual media.Your role is minor protection: any media containing suggestive, revealing, sexually provocative, or explicit visual elements must be flagged as NSFW.18 unmodified linesOutput strictly valid JSON with no extra conversational text, commentary, or markdown formatting outside the JSON object:{"caption": "<Detailed, objective visual description of the subject, clothing, exposure, pose, and setting>","is_nsfw": true | false,"reason": "<Precise reason for classification based on clothing, exposure, pose, context, or other visual cues>","nsfw": 1 | 0,"safe": 1 | 0}</code></pre></div></div></details><h2 style="font-weight: 700; border-bottom: 1px solid #333; padding-bottom: 10px; color: #FFFFFF;">Quick Start with Transformers</h2><div style="position: relative; margin-bottom: 20px;"><button style="position: absolute; top: 5px; right: 5px; background: #222; color: #fff; border: 1px solid #444; padding: 5px 10px; cursor: pointer; border-radius: 4px; z-index: 10;" onclick="copyCode(this)">Copy</button><pre style="background-color: #111111; border: 1px solid #333; border-radius: 4px; padding: 15px; overflow-x: auto; color: #FFFFFF; margin: 0;"><code>pip install transformerspip install accelerate</code></pre></div><div style="position: relative; margin-bottom: 20px;"><button style="position: absolute; top: 5px; right: 5px; background: #222; color: #fff; border: 1px solid #444; padding: 5px 10px; cursor: pointer; border-radius: 4px; z-index: 10;" onclick="copyCode(this)">Copy</button><pre style="background-color: #111111; border: 1px solid #333; border-radius: 4px; padding: 15px; overflow-x: auto; color: #FFFFFF; margin: 0;"><code>from transformers import Qwen3_5ForConditionalGeneration, AutoProcessorimport torchmodel = Qwen3_5ForConditionalGeneration.from_pretrained(44 unmodified linesclean_up_tokenization_spaces=False)print(output_text[0])</code></pre></div><h2 style="font-weight: 700; border-bottom: 1px solid #333; padding-bottom: 10px; color: #FFFFFF;">Training Details</h2><div style="margin-bottom: 20px; overflow-x: auto;"><table style="width: 100%; border-collapse: collapse; color: #FFFFFF;"><tbody><tr style="border-bottom: 1px solid #333;"><td style="padding: 10px; border: 1px solid #333; background-color: #111111; font-weight: bold; width: 30%;">Base Model</td><td style="padding: 10px; border: 1px solid #333; background-color: #050505;">Qwen/Qwen3.5-4B</td></tr><tr style="border-bottom: 1px solid #333;"><td style="padding: 10px; border: 1px solid #333; background-color: #111111; font-weight: bold;">Model</td><td style="padding: 10px; border: 1px solid #333; background-color: #050505;">VisionGuardrail-4B</td></tr><tr style="border-bottom: 1px solid #333;"><td style="padding: 10px; border: 1px solid #333; background-color: #111111; font-weight: bold;">Model Type</td><td style="padding: 10px; border: 1px solid #333; background-color: #050505;">Multimodal Content-Safety Classifier</td></tr><tr style="border-bottom: 1px solid #333;"><td style="padding: 10px; border: 1px solid #333; background-color: #111111; font-weight: bold;">Training Dataset</td><td style="padding: 10px; border: 1px solid #333; background-color: #050505;">prithivMLmods/ImageShield-Guardrail-Pro</td></tr><tr style="border-bottom: 1px solid #333;"><td style="padding: 10px; border: 1px solid #333; background-color: #111111; font-weight: bold;">Training Objective</td><td style="padding: 10px; border: 1px solid #333; background-color: #050505;">Content-safety guardrail classification</td></tr><tr style="border-bottom: 1px solid #333;"><td style="padding: 10px; border: 1px solid #333; background-color: #111111; font-weight: bold;">Primary Classification</td><td style="padding: 10px; border: 1px solid #333; background-color: #050505;">Safe / Unsafe</td></tr><tr style="border-bottom: 1px solid #333;"><td style="padding: 10px; border: 1px solid #333; background-color: #111111; font-weight: bold;">Safety Focus</td><td style="padding: 10px; border: 1px solid #333; background-color: #050505;">Not Safe for Work (NSFW) Sensual Content</td></tr><tr style="border-bottom: 1px solid #333;"><td style="padding: 10px; border: 1px solid #333; background-color: #111111; font-weight: bold;">Visual Analysis</td><td style="padding: 10px; border: 1px solid #333; background-color: #050505;">Dress Codes, Poses, Exposure & Settings</td></tr><tr><td style="padding: 10px; border: 1px solid #333; background-color: #111111; font-weight: bold;">Training Framework</td><td style="padding: 10px; border: 1px solid #333; background-color: #050505;">TRL</td></tr></tbody></table></div><h2 style="font-weight: 700; border-bottom: 1px solid #333; padding-bottom: 10px; color: #FFFFFF;">Intended Use</h2><div style="margin-bottom: 20px;"><div style="margin-bottom: 8px;"><span style="color: #FFFFFF;">+</span> <b>Content Safety Classification</b>: Classifying visual media as safe or unsafe.</div><div style="margin-bottom: 8px;"><span style="color: #FFFFFF;">+</span> <b>NSFW Sensual Content Detection</b>: Supporting research into automated detection of potentially sensitive and sexually suggestive visual content.</div><div style="margin-bottom: 8px;"><span style="color: #FFFFFF;">+</span> <b>Parental Controls</b>: Building conservative visual content-safety filtering systems.</div><div style="margin-bottom: 8px;"><span style="color: #FFFFFF;">+</span> <b>Content Moderation</b>: Supporting automated safety classification pipelines.</div><div style="margin-bottom: 8px;"><span style="color: #FFFFFF;">+</span> <b>Multimodal Safety Research</b>: Evaluating content-safety behavior in multimodal language models.</div><div style="margin-bottom: 8px;"><span style="color: #FFFFFF;">+</span> <b>Guardrail Development</b>: Researching structured safety classification and filtering workflows.</div><div style="margin-bottom: 8px;"><span style="color: #FFFFFF;">+</span> <b>Visual Safety Analysis</b>: Analyzing clothing, dress codes, poses, framing, and visual settings for content-safety signals.</div></div><h2 style="font-weight: 700; border-bottom: 1px solid #333; padding-bottom: 10px; color: #FFFFFF;">Limitations</h2><div style="margin-bottom: 20px;"><div style="margin-bottom: 8px;"><span style="color: #FFFFFF;">+</span> <b>Experimental Model</b>: The model may produce incorrect or inconsistent classifications.</div><div style="margin-bottom: 8px;"><span style="color: #FFFFFF;">+</span> <b>False Positives</b>: Benign content may occasionally be classified as unsafe due to the conservative classification threshold.</div><div style="margin-bottom: 8px;"><span style="color: #FFFFFF;">+</span> <b>False Negatives</b>: Unsafe content may occasionally be missed.</div><div style="margin-bottom: 8px;"><span style="color: #FFFFFF;">+</span> <b>Context Sensitivity</b>: Classification performance depends on image quality, visual context, and the provided instruction.</div><div style="margin-bottom: 8px;"><span style="color: #FFFFFF;">+</span> <b>Conservative Policy</b>: The model intentionally uses a strict classification threshold and may flag content that would not be considered NSFW under less restrictive moderation policies.</div><div style="margin-bottom: 8px;"><span style="color: #FFFFFF;">+</span> <b>Visual Ambiguity</b>: Clothing, poses, artistic styles, and contextual cues may sometimes be difficult to interpret accurately.</div><div style="margin-bottom: 8px;"><span style="color: #FFFFFF;">+</span> <b>Automated Classification</b>: The model should not be treated as a definitive legal or safety determination.</div></div><h2 style="font-weight: 700; border-bottom: 1px solid #333; padding-bottom: 10px; color: #FFFFFF;">Acknowledgements</h2><div style="margin-bottom: 20px;"><div style="margin-bottom: 8px;"><span style="color: #FFFFFF;">+</span> <a href="https://huggingface.co/Qwen/Qwen3.5-4B" style="color: #FF4500; text-decoration: none;">Qwen/Qwen3.5-4B</a>: Base multimodal model used for this project.</div><div style="margin-bottom: 8px;"><span style="color: #FFFFFF;">+</span> <a href="https://huggingface.co/datasets/prithivMLmods/ImageShield-Guardrail-Pro" style="color: #FF4500; text-decoration: none;">ImageShield-Guardrail-Pro</a>: Content-safety guardrail dataset used for training VisionGuardrail-4B.</div><div style="margin-bottom: 8px;"><span style="color: #FFFFFF;">+</span> <b>TRL</b> – <a href="https://huggingface.co/docs/trl/en/index" style="color: #FF4500; text-decoration: none;">Transformers Reinforcement Learning</a>: TRL is a full-stack library providing tools to train transformer language models with methods including Supervised Fine-Tuning (SFT), Group Relative Policy Optimization (GRPO), Direct Preference Optimization (DPO), Reward Modeling, and more.</div><div style="margin-bottom: 8px;"><span style="color: #FFFFFF;">+</span> <a href="https://huggingface.co/docs/transformers/en/index" style="color: #FF4500; text-decoration: none;">Transformers</a>: Transformers provides state-of-the-art machine learning models for text, computer vision, audio, video, and multimodal tasks, supporting both inference and training.</div></div></div>2 unmodified linesconst pre = btn.parentElement.querySelector('pre');const text = pre.innerText;navigator.clipboard.writeText(text).then(() => {btn.innerText = 'Copied!';setTimeout(() => {btn.innerText = 'Copy';}, 2000);});}1234567891011121314151617181920212223242526272829303132333435363738394018 unmodified lines59606162636465666768697071727374757677787980818283848586878844 unmodified lines1331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132 unmodified lines216217218219220221222223224<link href="https://fonts.googleapis.com/css2?family=Ubuntu:wght@300;400;500;700&family=Ubuntu+Mono&display=swap" rel="stylesheet"><div style="font-family: 'Ubuntu', sans-serif; background-color: #000000; color: #FFFFFF; max-width: 800px; margin: 0 auto; padding: 30px; border: 1px solid #222222; border-radius: 8px; line-height: 1.6;"><h1 style="font-size: 32px; font-weight: 700; margin-bottom: 15px; color: #FFFFFF;">VisionGuardrail-4B</h1><p style="font-size: 16px; margin-bottom: 25px; color: #FFFFFF;"><strong>VisionGuardrail-4B</strong> is a multimodal content-safety classifier based on <a href="https://huggingface.co/Qwen/Qwen3.5-4B" style="color: #FF4500; text-decoration: none;">Qwen/Qwen3.5-4B</a> and trained on the <a href="https://huggingface.co/datasets/prithivMLmods/ImageShield-Guardrail-Pro" style="color: #FF4500; text-decoration: none;">ImageShield-Guardrail-Pro</a> content-safety guardrail dataset. The model is designed to classify visual content as <strong>Safe</strong> or <strong>Unsafe</strong>, with a particular focus on detecting <strong>Not Safe for Work (NSFW) sensual content</strong> and other potentially sensitive visual content. VisionGuardrail-4B excels at detecting <strong>explicit and sensitive visual content</strong>, with detailed analysis of <strong>dress codes, clothing exposure, poses, framing, and different visual settings</strong> to support conservative content-safety classification.</p><div style="border: 1px solid #333333; padding: 15px; margin-bottom: 30px; border-radius: 4px; background-color: #0a0a0a;"><p style="margin: 0; font-size: 14px; color: #FFFFFF;">This model is an experimental release and may generate unexpected behaviors or reasoning artifacts in certain scenarios. <strong>This model is intended for research and content-safety classification only.</strong> Any outputs generated by this model are the sole responsibility of the user. The authors and hosting platform disclaim all liability for generated content. Users must ensure safe, ethical, and lawful usage.</p></div><h2 style="font-size: 22px; font-weight: 500; margin-bottom: 15px; color: #FFFFFF;">Key Highlights</h2><ul style="list-style-type: none; padding-left: 0; margin-bottom: 30px;"><li style="margin-bottom: 10px; font-size: 15px;"><span style="color: #FFFFFF; margin-right: 10px;">+</span> <strong>Qwen 3.5 Foundation</strong>: Built on <strong>Qwen/Qwen3.5-4B</strong>.</li><li style="margin-bottom: 10px; font-size: 15px;"><span style="color: #FFFFFF; margin-right: 10px;">+</span> <strong>Multimodal Content Filter</strong>: Designed for visual content-safety classification.</li><li style="margin-bottom: 10px; font-size: 15px;"><span style="color: #FFFFFF; margin-right: 10px;">+</span> <strong>ImageShield-Guardrail-Pro Training</strong>: Fine-tuned on the <strong>prithivMLmods/ImageShield-Guardrail-Pro</strong> content-safety guardrail dataset.</li><li style="margin-bottom: 10px; font-size: 15px;"><span style="color: #FFFFFF; margin-right: 10px;">+</span> <strong>Safe / Unsafe Classification</strong>: Classifies visual content as either <strong>Safe</strong> or <strong>Unsafe</strong>.</li><li style="margin-bottom: 10px; font-size: 15px;"><span style="color: #FFFFFF; margin-right: 10px;">+</span> <strong>NSFW Sensual Content Detection</strong>: Focused on identifying potentially <strong>Not Safe for Work (NSFW) sensual content</strong> and related sensitive visual material.</li><li style="margin-bottom: 10px; font-size: 15px;"><span style="color: #FFFFFF; margin-right: 10px;">+</span> <strong>Explicit & Sensitive Content Detection</strong>: Excels at identifying explicit, revealing, provocative, and otherwise potentially sensitive visual content.</li><li style="margin-bottom: 10px; font-size: 15px;"><span style="color: #FFFFFF; margin-right: 10px;">+</span> <strong>Dress-Code Analysis</strong>: Performs detailed analysis of clothing, dress codes, exposure, and revealing garments.</li><li style="margin-bottom: 10px; font-size: 15px;"><span style="color: #FFFFFF; margin-right: 10px;">+</span> <strong>Pose Analysis</strong>: Analyzes body poses, positioning, framing, and potentially suggestive presentation.</li><li style="margin-bottom: 10px; font-size: 15px;"><span style="color: #FFFFFF; margin-right: 10px;">+</span> <strong>Context & Setting Analysis</strong>: Considers different visual settings and contextual cues when determining content safety.</li><li style="margin-bottom: 10px; font-size: 15px;"><span style="color: #FFFFFF; margin-right: 10px;">+</span> <strong>Zero-Tolerance Safety Classification</strong>: Uses a conservative classification policy that favors safety when the content is ambiguous.</li><li style="margin-bottom: 10px; font-size: 15px;"><span style="color: #FFFFFF; margin-right: 10px;">+</span> <strong>Structured Output</strong>: Produces a machine-readable JSON response containing a caption, classification, and reasoning.</li></ul><details style="margin-bottom: 30px; border: 1px solid #333333; border-radius: 4px; padding: 10px; background-color: #0a0a0a;"><summary style="cursor: pointer; font-size: 18px; font-weight: 500; color: #FFFFFF; outline: none;">Standard Instruction</summary><div style="margin-top: 15px; position: relative; background-color: #000000; border: 1px solid #222222; padding: 15px; border-radius: 4px;"><button onclick="copyCode(this)" style="position: absolute; top: 10px; right: 10px; background-color: #333333; color: #FFFFFF; border: none; padding: 5px 10px; cursor: pointer; font-family: 'Ubuntu', sans-serif; font-size: 12px; border-radius: 4px;">Copy</button><pre style="white-space: pre-wrap; margin: 0; font-family: 'Ubuntu Mono', monospace; color: #FFFFFF; font-size: 14px;">You are a strict, zero-tolerance parental control content-safety guardrail classifier for visual media.Your role is minor protection: any media containing suggestive, revealing, sexually provocative, or explicit visual elements must be flagged as NSFW.18 unmodified linesOutput strictly valid JSON with no extra conversational text, commentary, or markdown formatting outside the JSON object:{"caption": "<Detailed, objective visual description of the subject, clothing, exposure, pose, and setting>","is_nsfw": true | false,"reason": "<Precise reason for classification based on clothing, exposure, pose, context, or other visual cues>","nsfw": 1 | 0,"safe": 1 | 0}</pre></div></details><h2 style="font-size: 22px; font-weight: 500; margin-bottom: 15px; color: #FFFFFF;">Quick Start with Transformers</h2><div style="position: relative; background-color: #0a0a0a; border: 1px solid #222222; padding: 15px; border-radius: 4px; margin-bottom: 20px;"><button onclick="copyCode(this)" style="position: absolute; top: 10px; right: 10px; background-color: #333333; color: #FFFFFF; border: none; padding: 5px 10px; cursor: pointer; font-family: 'Ubuntu', sans-serif; font-size: 12px; border-radius: 4px;">Copy</button><pre style="white-space: pre-wrap; margin: 0; font-family: 'Ubuntu Mono', monospace; color: #FFFFFF; font-size: 14px;">pip install transformerspip install accelerate</pre></div><div style="position: relative; background-color: #0a0a0a; border: 1px solid #222222; padding: 15px; border-radius: 4px; margin-bottom: 30px;"><button onclick="copyCode(this)" style="position: absolute; top: 10px; right: 10px; background-color: #333333; color: #FFFFFF; border: none; padding: 5px 10px; cursor: pointer; font-family: 'Ubuntu', sans-serif; font-size: 12px; border-radius: 4px;">Copy</button><pre style="white-space: pre-wrap; margin: 0; font-family: 'Ubuntu Mono', monospace; color: #FFFFFF; font-size: 14px;">from transformers import Qwen3_5ForConditionalGeneration, AutoProcessorimport torchmodel = Qwen3_5ForConditionalGeneration.from_pretrained(44 unmodified linesclean_up_tokenization_spaces=False)print(output_text[0])</pre></div><h2 style="font-size: 22px; font-weight: 500; margin-bottom: 15px; color: #FFFFFF;">Training Details</h2><table style="width: 100%; border-collapse: collapse; margin-bottom: 30px; font-size: 14px;"><tbody><tr style="border-bottom: 1px solid #222222;"><td style="padding: 12px; color: #FFFFFF; font-weight: bold; border-right: 1px solid #222222; width: 30%;">Base Model</td><td style="padding: 12px; color: #FFFFFF;">Qwen/Qwen3.5-4B</td></tr><tr style="border-bottom: 1px solid #222222;"><td style="padding: 12px; color: #FFFFFF; font-weight: bold; border-right: 1px solid #222222;">Model</td><td style="padding: 12px; color: #FFFFFF;">VisionGuardrail-4B</td></tr><tr style="border-bottom: 1px solid #222222;"><td style="padding: 12px; color: #FFFFFF; font-weight: bold; border-right: 1px solid #222222;">Model Type</td><td style="padding: 12px; color: #FFFFFF;">Multimodal Content-Safety Classifier</td></tr><tr style="border-bottom: 1px solid #222222;"><td style="padding: 12px; color: #FFFFFF; font-weight: bold; border-right: 1px solid #222222;">Training Dataset</td><td style="padding: 12px; color: #FFFFFF;">prithivMLmods/ImageShield-Guardrail-Pro</td></tr><tr style="border-bottom: 1px solid #222222;"><td style="padding: 12px; color: #FFFFFF; font-weight: bold; border-right: 1px solid #222222;">Training Objective</td><td style="padding: 12px; color: #FFFFFF;">Content-safety guardrail classification</td></tr><tr style="border-bottom: 1px solid #222222;"><td style="padding: 12px; color: #FFFFFF; font-weight: bold; border-right: 1px solid #222222;">Primary Classification</td><td style="padding: 12px; color: #FFFFFF;">Safe / Unsafe</td></tr><tr style="border-bottom: 1px solid #222222;"><td style="padding: 12px; color: #FFFFFF; font-weight: bold; border-right: 1px solid #222222;">Safety Focus</td><td style="padding: 12px; color: #FFFFFF;">Not Safe for Work (NSFW) Sensual Content</td></tr><tr style="border-bottom: 1px solid #222222;"><td style="padding: 12px; color: #FFFFFF; font-weight: bold; border-right: 1px solid #222222;">Visual Analysis</td><td style="padding: 12px; color: #FFFFFF;">Dress Codes, Poses, Exposure & Settings</td></tr><tr><td style="padding: 12px; color: #FFFFFF; font-weight: bold; border-right: 1px solid #222222;">Training Framework</td><td style="padding: 12px; color: #FFFFFF;">TRL</td></tr></tbody></table><h2 style="font-size: 22px; font-weight: 500; margin-bottom: 15px; color: #FFFFFF;">Intended Use</h2><ul style="list-style-type: none; padding-left: 0; margin-bottom: 30px;"><li style="margin-bottom: 10px; font-size: 15px;"><span style="color: #FFFFFF; margin-right: 10px;">+</span> <strong>Content Safety Classification</strong>: Classifying visual media as safe or unsafe.</li><li style="margin-bottom: 10px; font-size: 15px;"><span style="color: #FFFFFF; margin-right: 10px;">+</span> <strong>NSFW Sensual Content Detection</strong>: Supporting research into automated detection of potentially sensitive and sexually suggestive visual content.</li><li style="margin-bottom: 10px; font-size: 15px;"><span style="color: #FFFFFF; margin-right: 10px;">+</span> <strong>Parental Controls</strong>: Building conservative visual content-safety filtering systems.</li><li style="margin-bottom: 10px; font-size: 15px;"><span style="color: #FFFFFF; margin-right: 10px;">+</span> <strong>Content Moderation</strong>: Supporting automated safety classification pipelines.</li><li style="margin-bottom: 10px; font-size: 15px;"><span style="color: #FFFFFF; margin-right: 10px;">+</span> <strong>Multimodal Safety Research</strong>: Evaluating content-safety behavior in multimodal language models.</li><li style="margin-bottom: 10px; font-size: 15px;"><span style="color: #FFFFFF; margin-right: 10px;">+</span> <strong>Guardrail Development</strong>: Researching structured safety classification and filtering workflows.</li><li style="margin-bottom: 10px; font-size: 15px;"><span style="color: #FFFFFF; margin-right: 10px;">+</span> <strong>Visual Safety Analysis</strong>: Analyzing clothing, dress codes, poses, framing, and visual settings for content-safety signals.</li></ul><h2 style="font-size: 22px; font-weight: 500; margin-bottom: 15px; color: #FFFFFF;">Limitations</h2><ul style="list-style-type: none; padding-left: 0; margin-bottom: 30px;"><li style="margin-bottom: 10px; font-size: 15px;"><span style="color: #FFFFFF; margin-right: 10px;">+</span> <strong>Experimental Model</strong>: The model may produce incorrect or inconsistent classifications.</li><li style="margin-bottom: 10px; font-size: 15px;"><span style="color: #FFFFFF; margin-right: 10px;">+</span> <strong>False Positives</strong>: Benign content may occasionally be classified as unsafe due to the conservative classification threshold.</li><li style="margin-bottom: 10px; font-size: 15px;"><span style="color: #FFFFFF; margin-right: 10px;">+</span> <strong>False Negatives</strong>: Unsafe content may occasionally be missed.</li><li style="margin-bottom: 10px; font-size: 15px;"><span style="color: #FFFFFF; margin-right: 10px;">+</span> <strong>Context Sensitivity</strong>: Classification performance depends on image quality, visual context, and the provided instruction.</li><li style="margin-bottom: 10px; font-size: 15px;"><span style="color: #FFFFFF; margin-right: 10px;">+</span> <strong>Conservative Policy</strong>: The model intentionally uses a strict classification threshold and may flag content that would not be considered NSFW under less restrictive moderation policies.</li><li style="margin-bottom: 10px; font-size: 15px;"><span style="color: #FFFFFF; margin-right: 10px;">+</span> <strong>Visual Ambiguity</strong>: Clothing, poses, artistic styles, and contextual cues may sometimes be difficult to interpret accurately.</li><li style="margin-bottom: 10px; font-size: 15px;"><span style="color: #FFFFFF; margin-right: 10px;">+</span> <strong>Automated Classification</strong>: The model should not be treated as a definitive legal or safety determination.</li></ul><h2 style="font-size: 22px; font-weight: 500; margin-bottom: 15px; color: #FFFFFF;">Acknowledgements</h2><ul style="list-style-type: none; padding-left: 0; margin-bottom: 30px;"><li style="margin-bottom: 10px; font-size: 15px;"><span style="color: #FFFFFF; margin-right: 10px;">+</span> <a href="https://huggingface.co/Qwen/Qwen3.5-4B" style="color: #FF4500; text-decoration: none;">Qwen/Qwen3.5-4B</a>: Base multimodal model used for this project.</li><li style="margin-bottom: 10px; font-size: 15px;"><span style="color: #FFFFFF; margin-right: 10px;">+</span> <a href="https://huggingface.co/datasets/prithivMLmods/ImageShield-Guardrail-Pro" style="color: #FF4500; text-decoration: none;">ImageShield-Guardrail-Pro</a>: Content-safety guardrail dataset used for training VisionGuardrail-4B.</li><li style="margin-bottom: 10px; font-size: 15px;"><span style="color: #FFFFFF; margin-right: 10px;">+</span> <strong>TRL</strong> – <a href="https://huggingface.co/docs/trl/en/index" style="color: #FF4500; text-decoration: none;">Transformers Reinforcement Learning</a>: TRL is a full-stack library providing tools to train transformer language models with methods including Supervised Fine-Tuning (SFT), Group Relative Policy Optimization (GRPO), Direct Preference Optimization (DPO), Reward Modeling, and more.</li><li style="margin-bottom: 10px; font-size: 15px;"><span style="color: #FFFFFF; margin-right: 10px;">+</span> <a href="https://huggingface.co/docs/transformers/en/index" style="color: #FF4500; text-decoration: none;">Transformers</a>: Transformers provides state-of-the-art machine learning models for text, computer vision, audio, video, and multimodal tasks, supporting both inference and training.</li></ul></div>2 unmodified linesconst pre = btn.parentElement.querySelector('pre');const text = pre.innerText;navigator.clipboard.writeText(text).then(() => {btn.innerText = "Copied!";setTimeout(() => {btn.innerText = "Copy";}, 2000);});}
README.md+121-120