Giter Site home page Giter Site logo

jagin / detectron2-pipeline Goto Github PK

View Code? Open in Web Editor NEW
87.0 6.0 36.0 9.92 MB

Modular image processing pipeline using OpenCV and Python generators powered by Detectron2.

License: MIT License

Python 100.00%
detectron2 opencv image-processing video-processing computer-vision python

detectron2-pipeline's Introduction

Detectron2 pipeline

Modular image processing pipeline using OpenCV and Python generators powered by Detectron2.

For detailed description how to construct image processing pipeline using OpenCV and Python generators read the following Medium stories in order:

Setup environment

This project is using Conda for project environment management.

Setup the project environment:

$ conda env create -f environment.yml
$ conda activate detectron2-pipeline

or update the environment if you git pull the repo previously:

$ conda env update -f environment.yml

Install Detectron2 in a folder one level above the detectron2-pipeline project folder

$ cd ..
$ git clone https://github.com/facebookresearch/detectron2.git
$ cd detectron2
$ git checkout 3def12bdeaacd35c6f7b3b6c0097b7bc31f31ba4
$ python setup.py build develop

We checkout 3def12bdeaacd35c6f7b3b6c0097b7bc31f31ba4 commit to ensure that you can use the code out of the box with this repo.

If you got any problems with Detectron2 installation please refer to INSTALL.md.

Demo

Run the command to execute inferences on images from the selected folder:

$ python process_images.py -i assets/images/friends -p

By default the instance segmentation model is used from configs/COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x.yaml. You can try other models with --config-file option, for example:

$ python process_images.py -i assets/images/friends -p --config-file configs/COCO-Keypoints/keypoint_rcnn_R_50_FPN_3x.yaml

For video processing run:

$ python process_video.py -i assets/videos/walk.small.mp4 -p -d -ov walk.small.mp4

Tests

pytest is used as a test framework. All tests are stored in tests folder. Run the tests:

$ pytest

Resources and Credits

License

MIT License

detectron2-pipeline's People

Contributors

jagin 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

detectron2-pipeline's Issues

tracking took 15 seconds on >50 detections

hey @jagin , when you tested this pipeline, have you ever experimented on the number of detections vs how long it would took to solve the hungarian matching? im testing this and it took as long as 15 seconds on best_matching_hungarian after some profiling. Do you have any pointers where i can look to improve this or is this the limitations of the algorithm?

Thanks!

The video part is not working

The already existing issue on single process is still preveleant along with that the video analysis is not working. A empty directory is made and also according to me there is a problem in frame reading.

Display only certain pred_classes

Hi,

Thank you for this great work.
I want to run this as inference on my video but to display only certain class label.
In the original detectron2 I know I can do something like this:
predictions = predictor(frame)
instances = predictions["instances"]
category_detections = instances[instances.pred_classes == 0]

and display the output of draw_instance_predictions.

Is it possible to do something like this?

Thank you.

Not an issue — Pipeline

Hey @jagin, awesome repository! what online resources do you suggest for learning about pipeline (how does it work,...)? Thanks.

initial test, multiprocessor mode not working single process works

I am getting the following error

This may be due to my setup, the --single-process flag works fine.
Without --single-process the following error is emitted.

RuntimeError: cuda runtime error (801) : operation not supported at C:\w\1\s\tmp_conda_3.7_104508\conda\conda-bld\pytorch_1572950778684\work\torch/csrc/generic/StorageSharing.cpp:245
Traceback (most recent call last):
File "C:\test\lib\multiprocessing\queues.py", line 236, in _feed
obj = _ForkingPickler.dumps(obj)
File "C:\test\lib\multiprocessing\reduction.py", line 51, in dumps
cls(buf, protocol).dump(obj)
File "C:\test\lib\site-packages\torch\multiprocessing\reductions.py", line 242, in reduce_tensor
event_sync_required) = storage.share_cuda()
RuntimeError: cuda runtime error (801) : operation not supported at C:\w\1\s\tmp_conda_3.7_104508\conda\conda-bld\pytorch_1572950778684\work\torch/csrc/generic/StorageSharing.cpp:245
Traceback (most recent call last):
File "C:\test\lib\multiprocessing\queues.py", line 236, in _feed
obj = _ForkingPickler.dumps(obj)
File "C:\test\lib\multiprocessing\reduction.py", line 51, in dumps
cls(buf, protocol).dump(obj)
File "C:\test\lib\site-packages\torch\multiprocessing\reductions.py", line 242, in reduce_tensor
event_sync_required) = storage.share_cuda()
RuntimeError: cuda runtime error (801) : operation not supported at C:\w\1\s\tmp_conda_3.7_104508\conda\conda-bld\pytorch_1572950778684\work\torch/csrc/generic/StorageSharing.cpp:245
Process _PredictWorker-1:
Traceback (most recent call last):
File "C:\test\lib\multiprocessing\process.py", line 297, in _bootstrap
self.run()
File "C:\g\vn\lc\detectron2-pipeline\pipeline\libs\async_predictor.py", line 32, in run
task = self.task_queue.get()
File "C:\test\lib\multiprocessing\queues.py", line 94, in get
res = self._recv_bytes()
File "C:\test\lib\multiprocessing\connection.py", line 216, in recv_bytes
buf = self._recv_bytes(maxlength)
File "C:\test\lib\multiprocessing\connection.py", line 306, in _recv_bytes
[ov.event], False, INFINITE)

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.