Git Product home page Git Product logo

oshot_detection's Introduction

Demo implementation of OSHOT: One SHOT unsupervised cross domain detection.

This code is based on Maskrcnn-benchmark and uses Pytorch and CUDA.

This readme will guide you through a full run of our method for the Pascal VOC -> AMD benchmarks. Configuration files are provided also to perform other experiments.

Installation

Check INSTALL.md for installation instructions.

Datasets

Create a folder named datasets and include VOC2007 and VOC2012 source datasets (download from Pascal VOC's website).

Download and extract clipart1k, comic2k and watercolor2k from authors' website.

Performing OSHOT pretraining

To perform the pretraing using Pascal VOC as source dataset:

python tools/train_net.py --config-file configs/amd/voc_pretrain.yaml

By default training and inference are performed on a single GPU.

The final model will be saved in VOC_RS_baseline/model_final.pth.

Testing pretrained model

You can test a pretrained model on one of the AMD referring to the correct config-file. For example for clipart:

python tools/test_net.py --config-file configs/amd/oshot_clipart_target.yaml --ckpt VOC_RS_baseline/model_final.pth

Performing OSHOT adaptation

To use OSHOT adaptation rocedure and obtain results on one of the AMD please refer to one of the config files. For example for clipart:

python tools/oshot_net.py --config-file configs/amd/oshot_clipart_target.yaml --ckpt VOC_RS_baseline/model_final.pth

oshot_detection's People

Contributors

velodc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

oshot_detection's Issues

Can I run this project under Windows10๏ผŸ

Hello, thank you very much for your excellent work. I want to use my own data to retrain the network. May I ask whether I can run this project under Windows10 system?Looking forward to your reply. Thank you very much.

Some problem about 'python tools/oshot_net.py --config-file configs/amd/oshot_clipart_target.yaml --ckpt VOC_RS_baseline/model_final.pth'

I have done the two steps 'Performing OSHOT pretraining' and 'Testing pretrained model', however get this error when running 'Performing OSHOT adaptation':
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Traceback (most recent call last):
File "tools/oshot_net.py", line 119, in
main()
File "tools/oshot_net.py", line 108, in main
cfg=cfg
File "/home/hl/hl/oshot_detection-master/maskrcnn_benchmark/engine/oshot.py", line 151, in oshot_inference
predictions = compute_on_dataset(model, data_loader, device, oshot_breakpoints, inference_timer, cfg)
File "/home/hl/hl/oshot_detection-master/maskrcnn_benchmark/engine/oshot.py", line 99, in compute_on_dataset
log_test_image(cfg, summary_writer, "detections_{}_its".format(oshot_it+1), image_ids[0], images, output, image_name=image_name)
File "/home/hl/hl/oshot_detection-master/maskrcnn_benchmark/utils/log_image_bb.py", line 136, in log_test_image
log_image_and_bb(summary_writer, name, global_step, image, targets, image_name)
File "/home/hl/hl/oshot_detection-master/maskrcnn_benchmark/utils/log_image_bb.py", line 32, in log_image_and_bb
image = _overlay_boxes(image, targets)
File "/home/hl/hl/oshot_detection-master/maskrcnn_benchmark/utils/log_image_bb.py", line 98, in _overlay_boxes
colors = _compute_colors_for_labels(labels).tolist()
File "/home/hl/hl/oshot_detection-master/maskrcnn_benchmark/utils/log_image_bb.py", line 71, in _compute_colors_for_labels
cmcolors.append(np.array(cmap(lbl)[:3])*255)
File "/home/hl/anaconda3/envs/python37/lib/python3.7/site-packages/matplotlib/colors.py", line 561, in call
elif np.any(np.isnan(X)):
File "<array_function internals>", line 6, in any
File "/home/hl/anaconda3/envs/python37/lib/python3.7/site-packages/numpy/core/fromnumeric.py", line 2330, in any
return _wrapreduction(a, np.logical_or, 'any', axis, None, out, keepdims=keepdims)
File "/home/hl/anaconda3/envs/python37/lib/python3.7/site-packages/numpy/core/fromnumeric.py", line 85, in _wrapreduction
return reduction(axis=axis, out=out, **passkwargs)
TypeError: any() received an invalid combination of arguments - got (out=NoneType, axis=NoneType, ), but expected one of:

  • ()
  • (name dim, bool keepdim)
    didn't match because some of the keywords were incorrect: out, axis
  • (int dim, bool keepdim)
    didn't match because some of the keywords were incorrect: out, axis
    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

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.