GithubHelp home page GithubHelp logo

timy90022 / one-shot-object-detection Goto Github PK

View Code? Open in Web Editor NEW
423.0 423.0 83.0 2.29 MB

Implementation of One-Shot Object Detection with Co-Attention and Co-Excitation in Pytorch

License: MIT License

Python 69.60% MATLAB 0.36% C++ 4.02% Cuda 13.99% Shell 0.13% C 11.91%
object-detection one-shot-learning one-shot-object-detection pytorch

one-shot-object-detection's People

Contributors

aosokin avatar dependabot[bot] avatar htchen avatar timy90022 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

one-shot-object-detection's Issues

Error in compiling on Windows

@timy90022
Hello, tks for sharing a great work.
Iam in the very first steps to run your model. But Iam stuck in compiling part.
Iam having this error:
image

Iam using windows 10, cuda 9.0, cudnn 7.0.5, pytorch 1.0.1

why "Params" have no ioutype?

I see that the source code of pycocotools in other places contains the parameter ioutype (such as "bbox"). Why is there no such parameter in the code here

What `coco_{}_e2e_mask_rcnn_R_101_FPN_1x_caffe2.pkl` means & how to fix?

Hi, thanks for your contribution first.
Now I face some trouble when run this project. The following is the error log:

loading annotations into memory...
Done (t=16.83s)
creating index...
index created!
No reference file.
Traceback (most recent call last):
  File "trainval_net.py", line 195, in <module>
    seen=args.seen)
  File "/data/One-Shot-Object-Detection/lib/roi_data_layer/roidb.py", line 165, in combined_roidb
    imdb, roidb, query, reserved = get_roidb(s, training)
  File "/data/One-Shot-Object-Detection/lib/roi_data_layer/roidb.py", line 147, in get_roidb
    imdb = get_imdb(imdb_name)
  File "/data/One-Shot-Object-Detection/lib/datasets/factory.py", line 67, in get_imdb
    return __sets[name]()
  File "/data/One-Shot-Object-Detection/lib/datasets/factory.py", line 37, in <lambda>
    __sets[name] = (lambda split=split, year=year: coco(split, year))
  File "/data/One-Shot-Object-Detection/lib/datasets/coco.py", line 92, in __init__
    assert False
AssertionError

I found associated code line is like following:

        coco_name = image_set + year  # e.g., "val2014"
        self._data_name = (self._view_map[coco_name]
                           if coco_name in self._view_map
                           else coco_name)
        # Dataset splits that have ground-truth annotations (test splits
        # do not have gt annotations)
        self._gt_splits = ('train', 'val', 'minival')

        # set reference file
        self._reference_dir = os.path.join(cfg.DATA_DIR, "coco_reference_image")
        self._reference_file = os.path.join(self._reference_dir,
                                            "coco_{}_e2e_mask_rcnn_R_101_FPN_1x_caffe2.pkl".format(
                                                self._data_name))
        if not os.path.exists(self._reference_file): # ! error occur ! 
            print('No reference file.')
            assert False
        else:
            with open(self._reference_file, "rb") as f:
                self.reference_image = pickle.load(f)

What coco_{}_e2e_mask_rcnn_R_101_FPN_1x_caffe2.pkl means? Could you tell me how to fix this issue?
Thanks!

ImportError: cannot import name '_mask' from 'pycocotools'

Hi, thanks for your work at first.
But when I reimplement your results, I faced some errors.
After I clone the repo, I run the command :
python setup.py build develop

My envirionment is python3.7 and PyTorch1.1.
Then, when I run the code, there is some errors:
ImportError: cannot import name '_mask' from 'pycocotools' (/home/xyang/Code/practical/Few-shot/One-Shot-Object-Detection/lib/pycocotools/__init__.py)
I don't know if I need to run the setup.py with py2?

How to use COCO dataset

I am a beginner. I am comfuse which dataset should I use?(COCO 2014 or 5K minival?). And need I install the pycocotools ? thaks!!!!!!!

Params instance has no attribute 'areaRngLbl'

hello,sir. I folllowed the README to compile the project and download the pretrianed model, when I run command python test_net.py --s 2 --g 2 --a 4 --cuda, there are some errors when evaluating detection result:
Loading and preparing results...
DONE (t=2.12s)
creating index...
index created!
Running per image evaluation...
DONE (t=20.02s).
Accumulating evaluation results...
DONE (t=2.10s).
Traceback (most recent call last):
File "test_net.py", line 386, in
imdb_vu.evaluate_detections(all_boxes, output_dir_vu)
File "/home/joseph/project/One-Shot-Object-Detection/lib/datasets/coco.py", line 383, in evaluate_detections
self._do_detection_eval(res_file, output_dir)
File "/home/joseph/project/One-Shot-Object-Detection/lib/datasets/coco.py", line 323, in _do_detection_eval
cocoEval.summarize(class_index=tmp)
File "/home/joseph/project/One-Shot-Object-Detection/lib/datasets/coco.py", line 520, in summarize
self.stats = summarize()
File "/home/joseph/project/One-Shot-Object-Detection/lib/datasets/coco.py", line 486, in _summarizeDets
stats[0] = _summarize(1)
File "/home/joseph/project/One-Shot-Object-Detection/lib/datasets/coco.py", line 454, in _summarize
aind = [i for i, aRng in enumerate(p.areaRngLbl) if aRng == areaRng]
AttributeError: Params instance has no attribute 'areaRngLbl'
can you have any suggestion about this? Very appreciate for your reply!!

Testing on Custom Images

Hi

Thank you for your work on this repository. I am trying to test your model on custom images (not COCO), but it seems like the test_net.py required ground truth bounding boxes and image info.

There seems no. way to test the performance on custom images taking query and test image as input - could you please provide a script like that or help me modify your script for doings so ?

Thank you :)

Code for baselines

I am currently working on One shot object detection. I need the baseline results to compare with my model. In your paper, you compared your model with Compnet, SiamRPN and SiamFC. Can you please share your implementation of the baselines ? That would be very helpful.

Thanks
A

about multiple classes detect in same target images

thanks for your great works! and I have a question, during testing, Can I detect multiple classes simultaneously? or the query must one classes? for examples, if my target images have multiple classes to detect, I have to switch different queries to detect the target classes?

errors while doing the fresh install

Hi, I've just installed your code in a fresh conda env and got the following errors:

  • The following packages were required, but are not in requirements.txt: pandas, pillow==6.1.0
  • requirements.txt installed scipy 1.4.1, which was crashing on line from scipy.misc import imread. Needed to downgrade to 1.1.0
  • pycocotools were not compiling with your lib/setup.py, had to compile it manually separately

Fixing those might make future installs easier.

Bad results

@timy90022
I had tried your model in coco valid 2014 set.
and the results are not good.
for example this image:
image

Visualizing co-attention

I was wondering if it is possible to visualize the co-attention similar to figure 3 of the paper (also shown below). Is there a specific tensor we can use or does it require further processing?
image

Pretrained Model of ResNet50

This work is so great! Can you share your Pretrained Model--ResNet50? I have requested for access, but no answer. Thanks a lot!

Prepare reference image for other dataset

Hi,

I am trying to make a reference_image for other dataset. I understand the self.reference_image for COCO is described in Step 4,
image
But could you explain how the keys arranged?

Question about globalAvgPool operation in faster_rcnn.py

Hi, I've seen that for the squeeze co-excitation (SCE) part of the paper, a global average pooling operation is performed on the weighted non-local feature map. After I looked at the code implementation for SCE in faster_rcnn.py, I was a little confused because the global average pooling is not implemented in the forward pass in faster_rcnn.py, even though it's initialized in the match_block class, and I couldn't find any other implementations of it in the code base. I commented the GAP initialization and re-ran the test script on the COCO second group and found that it worked with similar accuracy.

Have I misinterpreted the implementation of GAP in SCE or am I looking in the wrong place?

Thanks!

demo

could you please send the demo code so that i can run it to test the trained model with visualization? thank U

The resnet50 pretrained model is trained on 725 classes??

Thank you for your work on this repository.

I want to know whether the resnet50 pretrained model in google drive is trained on Imagenet 725 classes?
and how the pretrained model is training, is it trained on One-shot-object-Detection framework??

What exactly is the validation set?

@timy90022 thanks for the code repo. I have a question regarding the validation set used during training. In the code, it looks like test set is used for validation. Could you please make it clear what exactly is the strategy here. Thanks.

question about gcc when compile

Hey, I want to ask if anyone has encountered this problem
gcc: error: ../MatlabAPI/private/maskApi.c: 没有那个文件或目录
error: command 'gcc' failed with exit status 1
how to solve it? Thank you.

ImportError: libtorch.so: cannot open shared object file: No such file or directory

Hello @timy90022
Thank you for your great work

When trying your code, i had the following error:

$ python test_net.py --s 1  --g 1 --a 4 --cuda
Traceback (most recent call last):
  File "test_net.py", line 26, in <module>
    from model.roi_layers import nms
  File "/home/gachiemchiep/workspace/github/One-Shot-Object-Detection/lib/model/roi_layers/__init__.py", line 3, in <module>
    from .nms import nms
  File "/home/gachiemchiep/workspace/github/One-Shot-Object-Detection/lib/model/roi_layers/nms.py", line 3, in <module>
    from model import _C
ImportError: libtorch.so: cannot open shared object file: No such file or directory

Do you have any idea about this error ?

IndexError: too many indices for array

Traceback (most recent call last):
File "trainval_net.py", line 305, in
data = next(data_iter)
File "/data/zww/anaconda3/envs/zwwpac/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 568, in next
return self._process_next_batch(batch)
File "/data/zww/anaconda3/envs/zwwpac/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 608, in _process_next_batch
raise batch.exc_type(batch.exc_msg)
IndexError: Traceback (most recent call last):
File "/data/zww/anaconda3/envs/zwwpac/lib/python3.6/site-packages/torch/utils/data/_utils/worker.py", line 99, in _worker_loop
samples = collate_fn([dataset[i] for i in batch_indices])
File "/data/zww/anaconda3/envs/zwwpac/lib/python3.6/site-packages/torch/utils/data/_utils/worker.py", line 99, in
samples = collate_fn([dataset[i] for i in batch_indices])
File "/data/zww/test/One-Shot-Object-Detection-master/lib/roi_data_layer/roibatchLoader.py", line 106, in getitem
catgory = blobs['gt_boxes'][:,-1]
IndexError: too many indices for array

Non local block operation

Hi,

Can anyone point me specifically about where can I find the non-local block which the authors have mentioned as the first step in their paper (Section 3) ? I am having a hard time finding the same in the code. Thanks.

Best,
Prathmesh.

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.