{"id":24225799,"url":"https://github.com/zoranzhao/deepthings","last_synced_at":"2025-09-22T16:31:36.709Z","repository":{"id":88494724,"uuid":"138666214","full_name":"zoranzhao/DeepThings","owner":"zoranzhao","description":"A Portable C Library for Distributed CNN Inference on IoT Edge Clusters","archived":false,"fork":false,"pushed_at":"2020-03-18T07:20:50.000Z","size":1893,"stargazers_count":73,"open_issues_count":7,"forks_count":41,"subscribers_count":4,"default_branch":"master","last_synced_at":"2023-10-21T00:07:07.344Z","etag":null,"topics":["deep-neural-networks","distributed-deep-learning","edge-computing","internet-of-things","iot-edge-clusters"],"latest_commit_sha":null,"homepage":"","language":"C","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/zoranzhao.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2018-06-26T01:00:31.000Z","updated_at":"2023-10-20T02:47:47.000Z","dependencies_parsed_at":null,"dependency_job_id":"669189db-8303-4842-b175-294cd296b78e","html_url":"https://github.com/zoranzhao/DeepThings","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zoranzhao%2FDeepThings","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zoranzhao%2FDeepThings/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zoranzhao%2FDeepThings/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zoranzhao%2FDeepThings/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zoranzhao","download_url":"https://codeload.github.com/zoranzhao/DeepThings/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":233862656,"owners_count":18742010,"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":["deep-neural-networks","distributed-deep-learning","edge-computing","internet-of-things","iot-edge-clusters"],"created_at":"2025-01-14T08:16:25.495Z","updated_at":"2025-09-22T16:31:30.841Z","avatar_url":"https://github.com/zoranzhao.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DeepThings\nDeepThings is a framework for locally distributed and adaptive CNN inference in resource-constrained IoT edge clusters. DeepThings mainly consists of:\n- A Fused Tile Partitioning (FTP) method for dividing convolutional layers into independently distributable tasks. FTP fuses layers and partitions them vertically\nin a grid fashion, which largely reduces communication and task migration overhead.\n- A distributed work stealing runtime system for IoT clusters to adaptively distribute FTP partitions in dynamic application scenarios.\n\nFor more details of DeepThings, please refer to [1].\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://zoranzhao.github.io/images/deepthings.png\" width=\"400px\" /\u003e\n  \u003cp\u003eOverview of the DeepThings framework.\u003c/p\u003e\n\u003c/div\u003e\n\nThis repository includes a lightweight, self-contained and portable C implementation of DeepThings. It uses a [NNPACK](https://github.com/digitalbrain79/NNPACK-darknet)-accelerated [Darknet](https://github.com/zoranzhao/darknet-nnpack) as the default inference engine. More information on porting DeepThings with different inference frameworks and platforms can be found below. \n\n## Platforms\nThe current implementation has been tested on [Raspberry Pi 3 Model B](https://www.raspberrypi.org/products/raspberry-pi-3-model-b/) running [Raspbian](https://www.raspberrypi.org/downloads/raspbian/). \n\n## Building\nEdit the configuration file [include/configure.h](https://github.com/zoranzhao/DeepThings/blob/master/include/configure.h) according to your IoT cluster parameters, then run:\n```bash\nmake clean_all\nmake \n\n```\nThis will automatically compile all related libraries and generate the DeepThings executable. If you want to run DeepThings on Raspberry Pi with NNPACK acceleration, you need first follow install [NNPACK](https://github.com/zoranzhao/darknet-nnpack/blob/2f2da6bd46b9bbfcd283e0556072f18581392f08/README.md) before running the Makefile commands, and set the options in Makefile as below:\n```\nNNPACK=1\nARM_NEON=1\n```\n\n## Downloading pre-trained CNN models and input data\nIn order to perform distributed inference, you need to download pre-trained CNN models and put it in [./models](https://github.com/zoranzhao/DeepThings/tree/master/models) folder.\nCurrent implementation is tested with YOLOv2, which can be downloaded from [YOLOv2 model](https://github.com/zoranzhao/DeepThings/blob/master/models/yolo.cfg) and [YOLOv2 weights](https://pjreddie.com/media/files/yolo.weights). If the link doesn't work, you can also find the weights [here](https://utexas.box.com/s/ax7f0j0qwnc4yb9ghjprjd93qwk3t4uw).\n\nFor input data, images need to be numbered (starting from 0) and renamed as \u003c#\u003e.jpg, and placed in [./data/input](https://github.com/zoranzhao/DeepThings/tree/master/data/input) folder.\n\n## Running in a IoT cluster\nAn overview of DeepThings command line options is listed below:\n```bash\n#./deepthings -mode \u003cexecution mode: {start, gateway, data_src, non_data_src}\u003e \n#             -total_edge \u003ctotal edge number: t\u003e \n#             -edge_id \u003cedge device ID: {0, ... t-1}\u003e\n#             -n \u003cFTP dimension: N\u003e \n#             -m \u003cFTP dimension: M\u003e \n#             -l \u003cnumber of fused layers: L\u003e\n```\nFor example, assuming you have a host machine H, gateway device G, and two edge devices E0 (data source) and E1 (idle), while \nyou want to perform a 5x5 FTP with 16 fused layers, then you need to follow the steps below:\n\nIn gateway device G:\n```bash\n./deepthings -mode gateway -total_edge 2 -n 5 -m 5 -l 16\n```\nIn edge device E0:\n```bash\n./deepthings -mode data_src -edge_id 0 -n 5 -m 5 -l 16\n```\nIn edge device E1:\n```bash\n./deepthings -mode non_data_src -edge_id 1 -n 5 -m 5 -l 16\n```\nNow all the devices will wait for a trigger signal to start. You can simply do that in your host machine H: \n```bash\n./deepthings -mode start\n```\n\n## Running in a single device\nMany people want to first try the FTP-partitioned inference in a single device. Now you can find a single-device execution example in [./examples](https://github.com/zoranzhao/DeepThings/tree/master/examples) folder. To run it:\n```bash\nmake clean_all\nmake\nmake test\n```\nThis will first initialize a gateway context and a client context in different local threads. FTP partition inference results will be transferred between queues associated with each context to emulate the inter-device communication.\n\n\n\n## Porting DeepThings\nOne just needs to simply modify the corresponding abstraction layer files to port DeepThings.\nIf you want to use a different CNN inference engine, modify: \n- [src/inference_engine_helper.c](https://github.com/zoranzhao/DeepThings/blob/master/src/inference_engine_helper.c)\n- [src/inference_engine_helper.h](https://github.com/zoranzhao/DeepThings/blob/master/src/inference_engine_helper.h)\n\nIf you want to port DeepThings onto a different OS (Currently using UNIX pthread), modify: \n- [distriot/src/thread_util.c](https://github.com/zoranzhao/DeepThings/blob/master/distriot/src/thread_util.c)\n- [distriot/src/thread_util.h](https://github.com/zoranzhao/DeepThings/blob/master/distriot/src/thread_util.h)\n\nIf you want to use DeepThings with different networking APIs (Currently using UNIX socket), modify: \n- [distriot/src/network_util.c](https://github.com/zoranzhao/DeepThings/blob/master/distriot/src/network_util.c)\n- [distriot/src/network_util.h](https://github.com/zoranzhao/DeepThings/blob/master/distriot/src/network_util.h)\n\n\n## References:\n[1] Z. Zhao, K. Mirzazad and A. Gerstlauer, \"[DeepThings: Distributed Adaptive Deep Learning Inference on Resource-Constrained IoT Edge Clusters](https://zoranzhao.github.io/docs/deepthings_2018.pdf),\" CODES+ISSS 2018, special issue of IEEE Transactions on \nComputer-Aided Design of Integrated Circuits and Systems (TCAD).\n\n## Contact:\nZhuoran Zhao, \u003czhuoran@utexas.edu\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzoranzhao%2Fdeepthings","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzoranzhao%2Fdeepthings","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzoranzhao%2Fdeepthings/lists"}