Instructions to use oliver0804/LocateAnything-3B-RK3588 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- RKLLM
How to use oliver0804/LocateAnything-3B-RK3588 with RKLLM:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
Download tools/prep_coco_subset.py from oliver0804/LocateAnything-3B-RK3588: direct link, hf CLI and curl.
- Browser
- Download file 1.37 kB
-
https://huggingface.co/oliver0804/LocateAnything-3B-RK3588/resolve/main/tools/prep_coco_subset.py
- Command line
-
hf download hf://oliver0804/LocateAnything-3B-RK3588/tools/prep_coco_subset.py
-
curl -L -o prep_coco_subset.py https://huggingface.co/oliver0804/LocateAnything-3B-RK3588/resolve/main/tools/prep_coco_subset.py
1.37 kB
| import json, random, collections, urllib.request, os | |
| d = json.load(open("instances_val2017.json")) | |
| cats = {c["id"]: c["name"] for c in d["categories"]} | |
| imgs = {i["id"]: i for i in d["images"]} | |
| by = collections.defaultdict(list) | |
| for a in d["annotations"]: | |
| if a["iscrowd"]: continue | |
| by[a["image_id"]].append(a) | |
| rng = random.Random(0); cand = [] | |
| for iid, anns in sorted(by.items()): | |
| W, H = imgs[iid]["width"], imgs[iid]["height"] | |
| cnt = collections.Counter(a["category_id"] for a in anns) | |
| cid, n = cnt.most_common(1)[0] | |
| g = [a for a in anns if a["category_id"] == cid] | |
| if not (1 <= n <= 8): continue | |
| if any(a["bbox"][2] * a["bbox"][3] < 32 * 32 for a in g): continue | |
| boxes = [[a["bbox"][0]/W*1000, a["bbox"][1]/H*1000, (a["bbox"][0]+a["bbox"][2])/W*1000, (a["bbox"][1]+a["bbox"][3])/H*1000] for a in g] | |
| cand.append({"id": iid, "file": "img/%012d.jpg" % iid, "cat": cats[cid], "n_gt": n, "boxes": boxes, "w": W, "h": H}) | |
| rng.shuffle(cand); sel = cand[:100] | |
| for s in sel: | |
| if not os.path.exists(s["file"]): | |
| urllib.request.urlretrieve("http://images.cocodataset.org/val2017/%012d.jpg" % s["id"], s["file"]) | |
| json.dump(sel, open("eval_set.json", "w")) | |
| print("candidates", len(cand), "selected", len(sel), "mean GT/img", sum(s["n_gt"] for s in sel)/len(sel)) | |
| print(collections.Counter(s["cat"] for s in sel).most_common(8)) | |