void AiliaInit() { // Create Ailia ailiaModel = CreateAiliaNet(imageSegmentaionModels, gpu_mode); // Load sample image LoadImage(imageSegmentaionModels, AiliaImageSource); }
void AiliaInit() { // Create Ailia ailiaModelVgg = new AiliaModel(); ailiaModelDecoder = new AiliaModel(); CreateAdainNet(ailiaModelVgg, ailiaModelDecoder, gpu_mode); // Load sample image ContentImageSource = gameObject.AddComponent <AiliaImageSource>(); StyleImageSource = gameObject.AddComponent <AiliaImageSource>(); ContentImageSource.CreateSource("file://" + Application.dataPath + "/AXIP/AILIA-MODELS/Adain/SampleImage/cornell.jpg"); StyleImageSource.CreateSource("file://" + Application.dataPath + "/AXIP/AILIA-MODELS/Adain/SampleImage/woman_with_hat_matisse.jpg"); }
void AiliaInit() { // Create Ailia ailiaModelWC = new AiliaModel(); ailiaModelBM = new AiliaModel(); CreateDewarpNet(ailiaModelWC, ailiaModelBM, gpu_mode); // Load sample image AiliaImageSource = gameObject.GetComponent <AiliaImageSource>(); if (AiliaImageSource == null) { AiliaImageSource = gameObject.AddComponent <AiliaImageSource>(); } AiliaImageSource.CreateSource("file://" + Application.dataPath + "/AXIP/AILIA-MODELS/ImageDeformation/SampleImage/dewarpnet_test.png"); }
// Download models and Create ailiaModel void CreateAdainNet(AiliaModel ailiaModelVgg, AiliaModel ailiaModelDecoder, bool gpu_mode = true) { string asset_path = Application.temporaryCachePath; string serverFolderName = "adain"; if (gpu_mode) { // call before OpenFile ailiaModelVgg.Environment(Ailia.AILIA_ENVIRONMENT_TYPE_GPU); ailiaModelDecoder.Environment(Ailia.AILIA_ENVIRONMENT_TYPE_GPU); } AiliaDownload ailia_download = new AiliaDownload(); ailia_download.DownloaderProgressPanel = UICanvas.transform.Find("DownloaderProgressPanel").gameObject; var urlList = new List <ModelDownloadURL>(); urlList.Add(new ModelDownloadURL() { folder_path = serverFolderName, file_name = "adain-vgg.onnx.prototxt" }); urlList.Add(new ModelDownloadURL() { folder_path = serverFolderName, file_name = "adain-vgg.onnx" }); urlList.Add(new ModelDownloadURL() { folder_path = serverFolderName, file_name = "adain-decoder.onnx.prototxt" }); urlList.Add(new ModelDownloadURL() { folder_path = serverFolderName, file_name = "adain-decoder.onnx" }); StartCoroutine(ailia_download.DownloadWithProgressFromURL(urlList, () => { modelPrepared = ailiaModelVgg.OpenFile(asset_path + "/adain-vgg.onnx.prototxt", asset_path + "/adain-vgg.onnx") & ailiaModelDecoder.OpenFile(asset_path + "/adain-decoder.onnx.prototxt", asset_path + "/adain-decoder.onnx"); })); }
// Download models and Create ailiaModel AiliaModel CreateAiliaNet(ImageSegmentaionModels modelType, bool gpu_mode = true) { string asset_path = Application.temporaryCachePath; string serverFolderName = ""; string prototxtName = ""; string onnxName = ""; switch (modelType) { case ImageSegmentaionModels.HRNetV2_W18_Small_v2: serverFolderName = "hrnet"; prototxtName = "HRNetV2-W18-Small-v2.onnx.prototxt"; onnxName = "HRNetV2-W18-Small-v2.onnx"; break; case ImageSegmentaionModels.HRNetV2_W18_Small_v1: serverFolderName = "hrnet"; prototxtName = "HRNetV2-W18-Small-v1.onnx.prototxt"; onnxName = "HRNetV2-W18-Small-v1.onnx"; break; case ImageSegmentaionModels.HRNetV2_W48: serverFolderName = "hrnet"; prototxtName = "HRNetV2-W48.onnx.prototxt"; onnxName = "HRNetV2-W48.onnx"; break; case ImageSegmentaionModels.hair_segmentation: serverFolderName = "hair_segmentation"; prototxtName = "hair_segmentation.opt.onnx.prototxt"; onnxName = "hair_segmentation.opt.onnx"; break; case ImageSegmentaionModels.pspnet_hair_segmentation: serverFolderName = "pspnet-hair-segmentation"; prototxtName = "pspnet-hair-segmentation.onnx.prototxt"; onnxName = "pspnet-hair-segmentation.onnx"; break; case ImageSegmentaionModels.deeplabv3: serverFolderName = "deeplabv3"; prototxtName = "deeplabv3.opt.onnx.prototxt"; onnxName = "deeplabv3.opt.onnx"; break; } ailiaModel = new AiliaModel(); if (gpu_mode) { // call before OpenFile ailiaModel.Environment(Ailia.AILIA_ENVIRONMENT_TYPE_GPU); } AiliaDownload ailia_download = new AiliaDownload(); ailia_download.DownloaderProgressPanel = UICanvas.transform.Find("DownloaderProgressPanel").gameObject; var urlList = new List <ModelDownloadURL>(); urlList.Add(new ModelDownloadURL() { folder_path = serverFolderName, file_name = prototxtName }); urlList.Add(new ModelDownloadURL() { folder_path = serverFolderName, file_name = onnxName }); StartCoroutine(ailia_download.DownloadWithProgressFromURL(urlList, () => { modelPrepared = ailiaModel.OpenFile(asset_path + "/" + prototxtName, asset_path + "/" + onnxName); })); return(ailiaModel); }
// Download models and Create ailiaModel AiliaModel CreateAiliaNet(ImageManipulationModels modelType, bool gpu_mode = true) { string asset_path = Application.temporaryCachePath; string serverFolderName = ""; string prototxtName = ""; string onnxName = ""; switch (modelType) { case ImageManipulationModels.SRResNet: serverFolderName = "srresnet"; prototxtName = "srresnet.opt.onnx.prototxt"; onnxName = "srresnet.opt.onnx"; break; case ImageManipulationModels.Noise2Noise: serverFolderName = "noise2noise"; prototxtName = "noise2noise_gaussian.onnx.prototxt"; onnxName = "noise2noise_gaussian.onnx"; break; case ImageManipulationModels.IlluminationCorrection: serverFolderName = "illnet"; prototxtName = "illnet.onnx.prototxt"; onnxName = "illnet.onnx"; break; case ImageManipulationModels.Colorization: serverFolderName = "colorization"; prototxtName = "colorizer.onnx.prototxt"; onnxName = "colorizer.onnx"; break; } ailiaModel = new AiliaModel(); if (gpu_mode) { // call before OpenFile ailiaModel.Environment(Ailia.AILIA_ENVIRONMENT_TYPE_GPU); } AiliaDownload ailia_download = new AiliaDownload(); ailia_download.DownloaderProgressPanel = UICanvas.transform.Find("DownloaderProgressPanel").gameObject; var urlList = new List <ModelDownloadURL>(); urlList.Add(new ModelDownloadURL() { folder_path = serverFolderName, file_name = prototxtName }); urlList.Add(new ModelDownloadURL() { folder_path = serverFolderName, file_name = onnxName }); StartCoroutine(ailia_download.DownloadWithProgressFromURL(urlList, () => { modelPrepared = ailiaModel.OpenFile(asset_path + "/" + prototxtName, asset_path + "/" + onnxName); })); return(ailiaModel); }