{"id":13771410,"url":"https://github.com/hollance/MobileNet-CoreML","last_synced_at":"2025-05-11T04:30:47.082Z","repository":{"id":53916315,"uuid":"93544971","full_name":"hollance/MobileNet-CoreML","owner":"hollance","description":"The MobileNet neural network using Apple's new CoreML framework","archived":false,"fork":false,"pushed_at":"2018-09-22T16:38:15.000Z","size":16709,"stargazers_count":709,"open_issues_count":5,"forks_count":99,"subscribers_count":33,"default_branch":"master","last_synced_at":"2025-04-05T07:03:50.714Z","etag":null,"topics":["core-ml","ios","machine-learning","mobilenet","swift"],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hollance.png","metadata":{"files":{"readme":"README.markdown","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-06-06T17:24:25.000Z","updated_at":"2025-02-17T05:37:39.000Z","dependencies_parsed_at":"2022-08-13T04:10:26.101Z","dependency_job_id":null,"html_url":"https://github.com/hollance/MobileNet-CoreML","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/hollance%2FMobileNet-CoreML","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hollance%2FMobileNet-CoreML/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hollance%2FMobileNet-CoreML/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hollance%2FMobileNet-CoreML/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hollance","download_url":"https://codeload.github.com/hollance/MobileNet-CoreML/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253518941,"owners_count":21921074,"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":["core-ml","ios","machine-learning","mobilenet","swift"],"created_at":"2024-08-03T17:00:51.196Z","updated_at":"2025-05-11T04:30:42.002Z","avatar_url":"https://github.com/hollance.png","language":"Swift","readme":"# MobileNet with CoreML\n\nThis is the **MobileNet** neural network architecture from the paper [MobileNets: Efficient Convolutional Neural Networks for Mobile Vision Applications](https://arxiv.org/abs/1704.04861v1) implemented using Apple's shiny new CoreML framework.\n\nThis uses the pretrained weights from [shicai/MobileNet-Caffe](https://github.com/shicai/MobileNet-Caffe).\n\nThere are two demo apps included:\n\n- **Cat Demo.** Shows the prediction for a cat picture. Open the project in Xcode 9 and run it on a device with iOS 11 or on the simulator. \n\n- **Camera Demo.** Runs from a live video feed and performs a prediction as often as it can manage. (You'll need to run this app on a device, it won't work in the simulator.)\n\n![The cat demo app](Screenshot.png)\n\n\u003e Note: Also check out [Forge](http://github.com/hollance/Forge), my neural net library for iOS 10 that comes with a version of MobileNet implemented in Metal.\n\n## Converting the weights\n\nThe repo already includes a fully-baked **MobileNet.mlmodel**, so you don't have to follow the steps in this section. However, in case you're curious, here's how I converted the original Caffe model into this .mlmodel file:\n\n1) Download the **caffemodel** file from [shicai/MobileNet-Caffe](https://github.com/shicai/MobileNet-Caffe) into the top-level folder for this project.\n\nNote: You don't have to download `mobilenet_deploy.prototxt`. There's already one included in this repo. (I added a Softmax layer at the end, which is missing from the original.)\n\n2) From a Terminal, do the following:\n\n```\n$ virtualenv -p /usr/bin/python2.7 env\n$ source env/bin/activate\n$ pip install tensorflow\n$ pip install keras==1.2.2\n$ pip install coremltools\n```\n\nIt's important that you set up the virtual environment using `/usr/bin/python2.7`. If you use another version of Python, the conversion script will crash with `Fatal Python error: PyThreadState_Get: no current thread`. You also need to use Keras 1.2.2 and not the newer 2.0.\n\n3) Run the **coreml.py** script to do the conversion:\n\n```\n$ python coreml.py\n```\n\nThis creates the **MobileNet.mlmodel** file.\n\n4) Clean up by deactivating the virtualenv:\n\n```\n$ deactivate\n```\n\nDone!\n\n","funding_links":[],"categories":["Model Compression","Models","Swift"],"sub_categories":["MobileNet"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhollance%2FMobileNet-CoreML","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhollance%2FMobileNet-CoreML","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhollance%2FMobileNet-CoreML/lists"}