This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -* | |
| import caffe | |
| import lmdb | |
| import numpy as np | |
| import cv2 | |
| from caffe.proto import caffe_pb2 | |
| import sys | |
| lmdb_env = lmdb.open(sys.argv[-1], map_size=int(1e9)) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class ClientActivity extends Activity implements View.OnClickListener { | |
| private static final String TAG = ClientActivity.class.getSimpleName(); | |
| private IRemoteService mService; | |
| private ServiceConnection mServiceConnection = new ServiceConnection() { | |
| @Override | |
| public void onServiceConnected(ComponentName name, IBinder service) { | |
| Toast.makeText(ClientActivity.this, "Service connected", Toast.LENGTH_SHORT).show(); | |
| mService = IRemoteService.Stub.asInterface(service); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <service | |
| android:name=".RemoteService" | |
| android:enabled="true" | |
| android:exported="true" > | |
| <intent-filter> | |
| <action android:name="com.xxx.xxx.IRemoteService" /> | |
| </intent-filter> | |
| </service> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class RemoteService extends Service { | |
| private static final String TAG = RemoteService.class.getSimpleName(); | |
| private final IRemoteService.Stub mBinder = new IRemoteService.Stub() { | |
| @Override | |
| public int someOperate(int a, int b) throws RemoteException { | |
| Log.d(TAG, "called RemoteService someOperate()"); | |
| return a + b; | |
| } | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| interface IRemoteService { | |
| int someOperate(int a, int b); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class MainActivity extends Activity { | |
| private MyReceiver receiver; | |
| @Override | |
| protected void onCreate(Bundle savedInstanceState) { | |
| super.onCreate(savedInstanceState); | |
| setContentView(R.layout.activity_main); | |
| // Register receiver dynamically. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public MyDownloadService extends IntentService { | |
| public static final int DOWNLOAD_ERROR = 10; | |
| public static final int DOWNLOAD_SUCCESS = 11; | |
| public MyDownloadService() { | |
| super(MyDownloadService.class.getName()); | |
| } | |
| @Override |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import tensorflow as tf | |
| from models import inception_resnet_v1 as network | |
| import os | |
| import numpy as np | |
| from tensorflow.python.framework.graph_util import convert_variables_to_constants | |
| def get_model_filenames(model_dir): | |
| files = os.listdir(model_dir) | |
| meta_files = [s for s in files if s.endswith('.meta')] | |
| if len(meta_files)==0: |