Giter Club home page Giter Club logo

count-anything's Introduction

count-anything

An empirical study on few-shot counting using segment anything (SAM)

Online Demo

arXiv

Meta AI recently released the Segment Anything model [SAM], which has garnered attention due to its impressive performance in class-agnostic segmenting. In this study, we explore the use of SAM for the challenging task of few-shot object counting, which involves counting objects of an unseen category by providing a few bounding boxes of examples. We compare SAM's performance with other few-shot counting methods and find that it is currently unsatisfactory without further fine-tuning, particularly for small and crowded objects.

image

Install

Install python dependencies. We use conda and python 3.10.4 and PyTorch 1.13.1

conda env create -f env.yaml

Dataset preparation

Comparison Results

FSC

image

COCO

image

Test

Download the ViT-H SAM model

  • For FSC-147:
python test_FSC.py --data_path <FSC-147 dataset path> --model_path <path to ViT-H SAM model>
  • For COCO val2017:
python test_coco.py --data_path <coco val2017 dataset path\> --model_path <path to ViT-H SAM model>

Visualize

You can run vis_FSC.ipynb for FSC-147 or vis_coco.ipynb for coco.

Acknowledgement

We thank facebookresearch for their segment-anything model [project], cvlab-stonybrook for their Learning To Count Everything [project] and coco [datasets].

Citation

If you find the code useful, please cite:

@article{ma2023countanything,
  title={CAN SAM COUNT ANYTHING? AN EMPIRICAL STUDY ON SAM COUNTING},
  author={Ma, Zhiheng and Hong, Xiaopeng and Shangguan Qinnan},
  journal={arXiv preprint arXiv:2304.10817},
  year={2023}
}

count-anything's People

Contributors

xiaopenghong avatar sg12qt avatar zhihengcv avatar iamwangyabin avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.