//ファイルを開く(メモリ) public virtual bool OpenMem(byte[] prototxt_buf, byte[] model_buf) { Close(); if (prototxt_buf == null || model_buf == null || prototxt_buf.Length == 0 || model_buf.Length == 0) { if (logging) { Debug.Log("input buffer is empty"); } return(false); } int status = Ailia.ailiaCreate(ref ailia, env_id, Ailia.AILIA_MULTITHREAD_AUTO); if (status != Ailia.AILIA_STATUS_SUCCESS) { if (logging) { Debug.Log("ailiaCreate failed " + status); } return(false); } status = Ailia.ailiaOpenStreamMem(ailia, prototxt_buf, (uint)prototxt_buf.Length); if (status != Ailia.AILIA_STATUS_SUCCESS) { if (logging) { Debug.Log("ailiaOpenStreamMem failed " + status); } Close(); return(false); } status = Ailia.ailiaOpenWeightMem(ailia, model_buf, (uint)model_buf.Length); if (status != Ailia.AILIA_STATUS_SUCCESS) { if (logging) { Debug.Log("ailiaOpenWeightMem filed " + status); } Close(); return(false); } return(true); }
//ファイルを開く(コールバック) public virtual bool OpenEx(Ailia.ailiaFileCallback callback, IntPtr arg1, IntPtr arg2) { Close(); int status = Ailia.ailiaCreate(ref ailia, env_id, Ailia.AILIA_MULTITHREAD_AUTO); if (status != Ailia.AILIA_STATUS_SUCCESS) { if (logging) { Debug.Log("ailiaCreate failed" + status); } return(false); } status = Ailia.ailiaOpenStreamEx(ailia, arg1, callback, Ailia.AILIA_FILE_CALLBACK_VERSION); if (status != Ailia.AILIA_STATUS_SUCCESS) { if (logging) { Debug.Log("ailiaOpenStreamFileEx failed" + status); } Close(); return(false); } status = Ailia.ailiaOpenWeightEx(ailia, arg2, callback, Ailia.AILIA_FILE_CALLBACK_VERSION); if (status != Ailia.AILIA_STATUS_SUCCESS) { if (logging) { Debug.Log("ailiaOpenWeightFileEx failed" + status); } Close(); return(false); } return(true); }
//ファイルを開く(ファイル) public virtual bool OpenFile(string prototxt_path, string model_path) { Close(); int status = Ailia.ailiaCreate(ref ailia, env_id, Ailia.AILIA_MULTITHREAD_AUTO); if (status != Ailia.AILIA_STATUS_SUCCESS) { if (logging) { Debug.Log("ailiaCreate failed " + status); } return(false); } status = Ailia.ailiaOpenStreamFile(ailia, prototxt_path); if (status != Ailia.AILIA_STATUS_SUCCESS) { if (logging) { Debug.Log("ailiaOpenStreamFile failed" + status); } Close(); return(false); } status = Ailia.ailiaOpenWeightFile(ailia, model_path); if (status != Ailia.AILIA_STATUS_SUCCESS) { if (logging) { Debug.Log("ailiaOpenWeightFile failed" + status); } Close(); return(false); } return(true); }