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
File size: 3,518 Bytes
ce88b75 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | """
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()
|