Image Segmentation
Transformers
grounding
instance-segmentation
polygon-prediction
baseline
research-code
Instructions to use royguw/ft_qwen3_5 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use royguw/ft_qwen3_5 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-segmentation", model="royguw/ft_qwen3_5")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("royguw/ft_qwen3_5", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Download scripts/inspect_data.py from royguw/ft_qwen3_5: direct link, hf CLI and curl.
- Browser
- Download file 3.52 kB
-
https://huggingface.co/royguw/ft_qwen3_5/resolve/main/scripts/inspect_data.py
- Command line
-
hf download hf://royguw/ft_qwen3_5/scripts/inspect_data.py
-
curl -L -o inspect_data.py https://huggingface.co/royguw/ft_qwen3_5/resolve/main/scripts/inspect_data.py
3.52 kB
| """ | |
| Print stats from a converted JSONL file. | |
| Usage: | |
| python scripts/inspect_data.py data/coconut_pos_neg_train.jsonl --show_samples 3 | |
| """ | |
| import argparse | |
| import json | |
| import logging | |
| import sys | |
| logging.basicConfig(level=logging.INFO, format="%(asctime)s [%(levelname)s] %(message)s") | |
| logger = logging.getLogger(__name__) | |
| def main(): | |
| parser = argparse.ArgumentParser(description="Inspect converted JSONL data") | |
| parser.add_argument("input", type=str, help="Path to JSONL file") | |
| parser.add_argument("--show_samples", type=int, default=0, | |
| help="Number of full samples to print") | |
| args = parser.parse_args() | |
| total_samples = 0 | |
| instance_counts = [] | |
| poly_point_counts = [] | |
| segment_counts = [] | |
| source_counts = {} | |
| grounding_text_lens = [] | |
| char_span_counts = [] | |
| samples_to_show = [] | |
| with open(args.input) as f: | |
| for line in f: | |
| line = line.strip() | |
| if not line: | |
| continue | |
| record = json.loads(line) | |
| total_samples += 1 | |
| instances = record.get("instances", []) | |
| instance_counts.append(len(instances)) | |
| grounding_text_lens.append(len(record.get("grounding_text", ""))) | |
| for inst in instances: | |
| src = inst.get("polygon_source", "unknown") | |
| source_counts[src] = source_counts.get(src, 0) + 1 | |
| polygons = inst.get("polygons", []) | |
| segment_counts.append(len(polygons)) | |
| for poly in polygons: | |
| poly_point_counts.append(len(poly)) | |
| spans = inst.get("char_spans", []) | |
| char_span_counts.append(len(spans)) | |
| if len(samples_to_show) < args.show_samples: | |
| samples_to_show.append(record) | |
| if total_samples == 0: | |
| logger.info("No samples found.") | |
| return | |
| def stats(vals): | |
| if not vals: | |
| return "N/A" | |
| import numpy as np | |
| a = np.array(vals) | |
| return f"mean={a.mean():.1f}, min={a.min()}, max={a.max()}, median={np.median(a):.1f}" | |
| print(f"\n{'='*60}") | |
| print(f"File: {args.input}") | |
| print(f"{'='*60}") | |
| print(f"Total samples: {total_samples}") | |
| print(f"Instances/sample: {stats(instance_counts)}") | |
| print(f"Segments/instance: {stats(segment_counts)}") | |
| print(f"Points/segment: {stats(poly_point_counts)}") | |
| print(f"Grounding text length: {stats(grounding_text_lens)}") | |
| print(f"Char spans/instance: {stats(char_span_counts)}") | |
| print(f"Polygon source distribution: {source_counts}") | |
| print(f"{'='*60}\n") | |
| for i, sample in enumerate(samples_to_show): | |
| print(f"--- Sample {i} ---") | |
| print(f" image: {sample.get('image', 'N/A')}") | |
| print(f" grounding_text: {sample.get('grounding_text', '')[:100]}...") | |
| print(f" num_instances: {len(sample.get('instances', []))}") | |
| print(f" instance_order: {sample.get('instance_order', [])}") | |
| print(f" orig_h x orig_w: {sample.get('orig_h', '?')} x {sample.get('orig_w', '?')}") | |
| for j, inst in enumerate(sample.get("instances", [])[:3]): | |
| n_polys = len(inst.get("polygons", [])) | |
| n_pts = sum(len(p) for p in inst.get("polygons", [])) | |
| print(f" instance[{j}]: {n_polys} segments, {n_pts} points, " | |
| f"source={inst.get('polygon_source', '?')}, " | |
| f"spans={inst.get('char_spans', [])}") | |
| print() | |
| if __name__ == "__main__": | |
| main() | |