{"id":13499102,"url":"https://github.com/MG2033/ShuffleNet","last_synced_at":"2025-03-29T03:32:20.801Z","repository":{"id":49850514,"uuid":"103679148","full_name":"MG2033/ShuffleNet","owner":"MG2033","description":"ShuffleNet Implementation in TensorFlow","archived":false,"fork":false,"pushed_at":"2018-12-04T07:22:48.000Z","size":196,"stargazers_count":384,"open_issues_count":10,"forks_count":125,"subscribers_count":17,"default_branch":"master","last_synced_at":"2024-10-31T17:39:09.888Z","etag":null,"topics":["classification","computer-vision","deep-learning","group-convolution","realtime","shufflenet","tensorflow"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MG2033.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}},"created_at":"2017-09-15T16:36:56.000Z","updated_at":"2024-03-22T08:27:25.000Z","dependencies_parsed_at":"2022-09-21T12:45:18.358Z","dependency_job_id":null,"html_url":"https://github.com/MG2033/ShuffleNet","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/MG2033%2FShuffleNet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MG2033%2FShuffleNet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MG2033%2FShuffleNet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MG2033%2FShuffleNet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MG2033","download_url":"https://codeload.github.com/MG2033/ShuffleNet/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246135765,"owners_count":20729056,"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":["classification","computer-vision","deep-learning","group-convolution","realtime","shufflenet","tensorflow"],"created_at":"2024-07-31T22:00:28.743Z","updated_at":"2025-03-29T03:32:20.537Z","avatar_url":"https://github.com/MG2033.png","language":"Python","funding_links":[],"categories":["Papers\u0026Codes","DLA"],"sub_categories":["ShuffleNet"],"readme":"# ShuffleNet\nAn implementation of `ShuffleNet` introduced in TensorFlow. According to the authors, `ShuffleNet` is a computationally efficient CNN architecture designed specifically for mobile devices with very limited computing power. It outperforms `Google MobileNet` by\nsmall error percentage at much lower FLOPs.\n\nLink to the original paper: [ShuffleNet: An Extremely Efficient Convolutional Neural Network for Mobile Devices](https://arxiv.org/abs/1707.01083)\n\n\n## ShuffleNet Unit\n\u003cdiv align=\"center\"\u003e\n\u003cimg src=\"https://github.com/MG2033/ShuffleNet/blob/master/figures/unit.PNG\"\u003e\u003cbr\u003e\u003cbr\u003e\n\u003c/div\u003e\n\n### Group Convolutions\nThe paper uses the group convolution operator. However, that operator is not implemented in TensorFlow backend. So, I implemented the operator using graph operations.\n\nThis issue was discussed here: [Support Channel groups in convolutional layers #10482](https://github.com/tensorflow/tensorflow/pull/10482)\n## Channel Shuffling\n\u003cdiv align=\"center\"\u003e\n\u003cimg src=\"https://github.com/MG2033/ShuffleNet/blob/master/figures/shuffle.PNG\"\u003e\u003cbr\u003e\u003cbr\u003e\n\u003c/div\u003e\n\n### Channel Shuffling can be achieved by applying three operations:\n1. Reshaping the input tensor from (N, H, W, C) into (N, H, W, G, C').\n2. Performing matrix transpose operation on the two dimensions (G, C').\n3. Reshaping the tensor back into (N, H, W, C). \n\n    N: Batch size,\n    H: Feature map height,\n    W: Feature map width,\n    C: Number of channels,\n    G: Number of groups,\n    C': Number of channels / Number of groups\n\n    Note that: The number of channels should be divisible by the number of groups.\n\n## Usage\n### Main Dependencies\n ```\n Python 3 or above\n tensorflow 1.3.0\n numpy 1.13.1\n tqdm 4.15.0\n easydict 1.7\n matplotlib 2.0.2\n ```\n### Train and Test\n1. Prepare your data, and modify the data_loader.py/DataLoader/load_data() method.\n2. Modify the config/test.json to meet your needs.\n\n### Run\n```\npython main.py --config config/test.json\n```\n\n## Results\nThe model have successfully overfitted TinyImageNet-200 that was presented in [CS231n - Convolutional Neural Networks for Visual Recognition](https://tiny-imagenet.herokuapp.com/). I'm working on ImageNet training..\n\n## Benchmarking\nThe paper has achieved 140 MFLOPs using the vanilla version. Using the group convolution operator implemented in TensorFlow, I have achieved approximately 270 MFLOPs. The paper counts multiplication+addition as one unit, so roughly dividing 270 by two, I have achieved what the paper proposes.\n\nTo calculate the FLOPs in TensorFlow, make sure to set the batch size equal to 1, and execute the following line when the model is loaded into memory.\n```\ntf.profiler.profile(\n        tf.get_default_graph(),\n        options=tf.profiler.ProfileOptionBuilder.float_operation(), cmd='scope')\n```\n\n## TODO\n* Training on ImageNet dataset. In progress...\n\n## Updates\n* Inference and training are working properly.\n\n## License\nThis project is licensed under the Apache License 2.0 - see the LICENSE file for details.\n\n## Acknowledgments\nThanks for all who helped me in my work and special thanks for my colleagues: [Mo'men Abdelrazek](https://github.com/moemen95), and [Mohamed Zahran](https://github.com/moh3th1).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMG2033%2FShuffleNet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FMG2033%2FShuffleNet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMG2033%2FShuffleNet/lists"}