Code Monkey home page Code Monkey logo

psp's Introduction

PSP: Automatic Check-out via Prototype-based Classifier Learning from Single-Product Exemplars


Environment

Python 3.7.11
Pytorch 1.7.1
torchvision 0.8.2
cudatoolkit 10.1.243
mmcv-full 1.3.9
mmdet 2.14.0


Installation

The installation process of our code can follow the MMDetection in the url: https://mmdetection.readthedocs.io/en/v2.14.0/get_started.html and overlay the original files by our code.
Or you can download our code and the file "README.md" of MMDetection, then run ''python setup.py develop'' .


Dataset

You can download the RPC dataset by these two urls:
https://www.kaggle.com/diyer22/retail-product-checkout-dataset
https://pan.baidu.com/s/1vrrLaSpJe5JxT3zhYfOaog


Necessary modifications

Before training or testing, you must modify the contents of the paths in the following files.

  1. configs/rpc/xxx.py
    In these configuration files, you need modify the following parameters.

    data_root = '{your_dataset_root_path}'
    img_prefix = '{your_train_or_test_dataset_path}'
    ann_file = '{your_train_or_test_annotation_file}'  
    
  2. rpc_eval.py
    The default value of --ann_file can be modified as {your_train_or_test_annotation_file}.

  3. rpc_one_img_py
    In this file, you need modify the test annotation file in following:

    with open('{your_test_annotation_file}', 'r') as f:  
    img ='{test_image_file}'  
    out_file='{result_out_file}'  
    

Train

We train our model in one 2080Ti card, and the training command is:

python tools/train.py {config file}  

and an example is:

python tools/train.py configs/rpc/faster_rcnn_r50_fpn_3x_rpc_protoS_srr_mll.py  

Test

Our testing command is:

 python tools/test.py {config file} {checkpoint_file} [--out {result_file}] [--eval bbox]  

and an example is:

python tools/test.py configs/rpc/faster_rcnn_r50_fpn_3x_rpc_protoS_srr_mll.py \
       result/faster_rcnn_r50_fpn_3x_rpc_protoS_srr_mll/latest.pth --out \
       result/faster_rcnn_r50_fpn_3x_rpc_protoS_srr_mll/result.pkl --eval bbox  

Evaluate

Since 4 metrics other than mAP50 and mmAP are used, we perform the computation of these 4 metrics separately for the result file, i.e. rpc_eval.py.
This evaluation file can print 4 metric values for all clutter patterns. And the evaluating command is:

 python rpc_eval.py [--root {result_root_path}]  

and an example is:

python rpc_eval.py --root ./result/faster_rcnn_r50_fpn_3x_rpc_protoS_srr_mll/  

Note

If you want to train, test and evaluate the model sequentially at once, you can run the "rpc_run.py" file directly.

python rpc_run.py

If you want to use other configs, you only need modify the corresponding file names or paths in the "rpc_run.py" file.

psp's People

Contributors

hao-chen-njust avatar

Stargazers

 avatar

Watchers

 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.