{"id":15458929,"url":"https://github.com/ntamvl/deepdetect_ruby","last_synced_at":"2025-04-22T10:19:41.276Z","repository":{"id":56844120,"uuid":"76840072","full_name":"ntamvl/deepdetect_ruby","owner":"ntamvl","description":"DeepDetect Client for Ruby","archived":false,"fork":false,"pushed_at":"2016-12-19T08:08:43.000Z","size":26,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-18T19:28:20.813Z","etag":null,"topics":["machine-learning","prediction","ruby","ruby-deepdetect"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ntamvl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-12-19T07:46:45.000Z","updated_at":"2017-06-12T03:17:30.000Z","dependencies_parsed_at":"2022-09-01T08:11:49.271Z","dependency_job_id":null,"html_url":"https://github.com/ntamvl/deepdetect_ruby","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ntamvl%2Fdeepdetect_ruby","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ntamvl%2Fdeepdetect_ruby/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ntamvl%2Fdeepdetect_ruby/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ntamvl%2Fdeepdetect_ruby/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ntamvl","download_url":"https://codeload.github.com/ntamvl/deepdetect_ruby/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250221194,"owners_count":21394679,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["machine-learning","prediction","ruby","ruby-deepdetect"],"created_at":"2024-10-01T23:03:28.955Z","updated_at":"2025-04-22T10:19:41.247Z","avatar_url":"https://github.com/ntamvl.png","language":"Ruby","readme":"# DeepDetect for Ruby\nDeepDetect is a Deep Learning API and server written in C++11. It makes the state-of-the-art Deep Learning easy to work with and can easily be integrated into existing applications.\n\n## DeepDetect supports the following features:\n### General\n+ High level \u0026 generic API for machine learning \u0026 deep learning\n+ JSON communication format\n+ Remote Python client library\n+ Embedded server with support for asynchronous training calls\n+ High performance, benefits from multicores and GPU\n+ Flexible input / output connectors\n+ Flexible template output format to simplify connection with external applications\n+ Removal of database dependency and sync, as everything is organized on the filesystem\n\n### Machine Learning / Deep Learning\n+ Support for state-of-the-art Deep Learning via Caffe library\n+ Templates for the most useful neural architectures (e.g. Googlenet, Alexnet, NiN, mlp, convnet, logistic regression)\n+ Range of built-in model assessment measures (e.g. F1, multiclass log loss, …)\n+ Support for multiple Machine Learning services, training and prediction calls in parallel\n+ Optimization for CPUs and GPUs\n+ Supervised learning, regression and prediction over images and other numerical and textual data\n\n### Data\n+ Built-in input connectors to ease the setup of a machine learning pipeline\n+ Easy management for large datasets of images\n+ Easy management and preprocessing for CSV data files\n+ Connector to handle large collections of images with on-the-fly data augmentation (e.g. rotations, mirroring)\n+ Connector to handle CSV files with preprocessing capabilities\n+ Connector to handle text files\n+ Output connectors for various external applications being able to be set up through templates via the API, without code (e.g. for Elasticsearch, XML, SQL, …)\n\n# Architecture Diagram\n![DeepDetect Ruby App Diagram](https://c4.staticflickr.com/6/5479/30255507155_10d1fdc799_b.jpg)\n\n## Requirements\n- Ubuntu 14.04 LTS\n- Ruby 2.2.1 or above\n- Rails 4.2.5 or above\n- DeepDetect\n- DeepDetect Dependencies:\n    - C++, gcc \u003e= 4.8 or clang with support for C++11 (there are issues with Clang + Boost)\n    - eigen for all matrix operations\n    - glog for logging events and debug\n    - gflags for command line parsing\n    - OpenCV \u003e= 2.4\n    - cppnetlib\n    - Boost\n    - curl\n    - curlpp\n    - utfcpp\n    - gtest for unit testing (optional)\n- Caffe Dependencies:\n    - CUDA 7 or 6.5 is required for GPU mode.\n    - BLAS via ATLAS, MKL, or OpenBLAS.\n    - protobuf\n    - IO libraries hdf5, leveldb, snappy, lmdb\n\n## Installation\nWelcome to your new gem! In this directory, you'll find the files you need in order to package your Ruby library into a gem.\n\nPut your Ruby code in the file `lib/deepdetect_ruby`. To experiment with that code, run `bin/console` for an interactive prompt.\n\n**Add this line to your application's Gemfile:**\n\n```ruby\ngem 'deepdetect_ruby', git: \"git@github.com:ntamvl/deepdetect_ruby.git\"\n```\nAnd then execute:\n```\n$ bundle\n```\nOr install it yourself as:\n```\n$ gem install deepdetect_ruby\n```\n\n## Build DeepDetect\n- On Ubuntu Linux, do:\n```\nsudo apt-get install build-essential libgoogle-glog-dev libgflags-dev libeigen3-dev libopencv-dev libcppnetlib-dev libboost-dev libboost-iostreams-dev libcurlpp-dev libcurl4-openssl-dev protobuf-compiler libopenblas-dev libhdf5-dev libprotobuf-dev libleveldb-dev libsnappy-dev liblmdb-dev libutfcpp-dev cmake\n```\n- Build from source code:\n```\ncd\ngit clone git@github.com:beniz/deepdetect.git \u0026\u0026 cd deepdetect\nmkdir build \u0026\u0026 cd build\ncmake ..\nmake\n```\n\n## Usage\nConfigure on Rails at `config/application.rb`\n\n*for single server*\n```ruby\nDeepdetectRuby.configure do |config|\n    config.host = \"http://deepdetect_server_ip_or_domain:8080\"\n    config.model_path = \"/home/tamnguyen/models\"\nend\n```\n\n*for multiple servers*\n```ruby\nDeepdetectRuby.configure do |config|\n    config.model_path = \"/home/tamnguyen/models\"\n    config.is_scaling = true\n    config.servers = \"http://deepdetect_server_ip_or_domain_1:8080, http://deepdetect_server_ip_or_domain_2:8080\"\nend\n```\n\n**Example config at `config/application.rb`**\n```ruby\n# begin load DeepDetect config\nconfig_file_path = \"#{Rails.root}/config/deepdetect.json\"\nmodel_hash = JSON.parse(File.read(config_file_path))\nmodel_path = model_hash[\"model_path\"]\nDeepdetectRuby.configure do |config|\n    # config.host = \"http://127.0.0.1:8080\"\n    config.model_path = \"#{model_path}\"\n    config.debug = false\n    config.is_scaling = true\n    config.servers = \"http://deepdetect_server_ip_or_domain_1:8080, http://deepdetect_server_ip_or_domain_2:8080\"\nend\n# end load DeepDetect config\n```\n*with `deepdetect.json` at `config/deepdetect.json`*\n```ruby\n{\n  \"model_path\": \"/home/ubuntu/projects/deepdetect/models\"\n}\n```\n## Create a deepdetect service\nExample: Test creating a service\n```ruby\noptions = {\n            \"name\": \"tress\",\n            \"mllib\": \"caffe\",\n            \"description\": \"trees classification\",\n            \"type\": \"supervised\",\n            \"connector\": \"image\",\n            \"height\": 224,\n            \"width\": 224,\n            \"nclasses\": 304,\n            \"repository\": \"/home/tamnguyen/models/trees\"\n            }\n\nDeepdetectRuby::Service.create(options)\n```\n*with default options*\n```ruby\noptions = {\n           :name =\u003e \"[name of service]\",\n          :mllib =\u003e \"caffe\",\n    :description =\u003e \"\",\n           :type =\u003e \"supervised\",\n      :connector =\u003e \"image\",\n          :width =\u003e 224,\n         :height =\u003e 224,\n       :nclasses =\u003e 2,\n     :model_path =\u003e \"[path to models on server]\"\n}\n```\n\n## Launch a training job\n```ruby\nDeepdetectRuby::Train.launch(options = {}, is_custom_data = false)\n```\n\n## Get information on a training job\n```ruby\nDeepdetectRuby::Train.get_status(options = {})\n```\n*with default options*\n```ruby\noptions = {\n        :job =\u003e 1,\n    :timeout =\u003e 20,\n    :service =\u003e \"[name of service]\"\n}\n```\n\n## Delete a training job\n```ruby\nDeepdetectRuby::Train.delete(options = {})\n```\n*with default options*\n```ruby\noptions = {\n        :job =\u003e 1,\n    :service =\u003e \"[name of service]\"\n}\n```\n\n## Prediction\n```ruby\nDeepdetectRuby::Predict.predict(options)\n```\n*with default options*\n```ruby\noptions = {\n         :best =\u003e 2,\n          :gpu =\u003e true,\n      :service =\u003e \"[name of service]\",\n    :image_url =\u003e \"[image url]\",\n     :template =\u003e \"[output template]\"\n}\n```\n\n## Fine tune model\n```ruby\nDeepdetectRuby::Service.finetune(options)\n```\n*with options*\n```ruby\noptions = {\n               :name =\u003e \"[string - service name]\",\n            :weights =\u003e \"[filename of caffe model]\",\n         :repository =\u003e \"[repo path]\",\n                :gpu =\u003e true,\n         :iterations =\u003e 10000,\n      :test_interval =\u003e 500,\n           :nclasses =\u003e 2,\n      :measure_index =\u003e 1,\n         :batch_size =\u003e 32,\n    :test_batch_size =\u003e 32\n}\n```\n\n## Suggestion for Diagram of neural network models\n\nIn order to receive results with high accuracy, when applied to Pixai, this diagram of neural network models should be used as suggested below:\n![Chain of Models Diagram](https://c2.staticflickr.com/6/5492/29641623713_c43b64d5e3_b.jpg)\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow experimentation.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contribution\nDeepDetect Ruby gem is designed and implemented by Tam Nguyen ntamvl@gmail.com](ntamvl@gmail.com)\nBug reports and pull requests are welcome on GitHub at https://github.com/ntamvl/deepdetect_ruby.\n\n## License\nThe gem is available as a private repository under MIT License\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fntamvl%2Fdeepdetect_ruby","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fntamvl%2Fdeepdetect_ruby","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fntamvl%2Fdeepdetect_ruby/lists"}