Unable to create project for custom vision image classification using Java SDK - azure-cognitive-services

I am unable to create the project for the custom vision image classification using Java SDK. It is giving an error in the following line in the main method of CustomVisionQuickstart.java
Project project = createProject(trainClient);
I am following the Java SDK quickstart guide for custom vision
https://learn.microsoft.com/en-us/azure/cognitive-services/custom-vision-service/quickstarts/image-classification?tabs=visual-studio&pivots=programming-language-java#prerequisites

The following the code block used in the current scenario:
CustomVisionQuickstart.java
Project project = createProject(trainClient);
Replace the above code block with the below code block
Trainings trainings = client.trainings();
Project project = trainings.createProject().withName("Dog Breeds").execute();
This will solve the error.
For complete project creation and implementation in Java. Checkout the link
Document Credits: Ruth Yakubu

Related

Custom Machine learning code to import in the android studio

I am creating a project of fake news detection in android. I have trained the model and converted into the tensorflow lite. I tried to import it into the android studio in asset folder but it showed the message "This is not valid tensorflow lite model file".
enter image description here
can anyone help me to deploy it into android studio and to generate the input/output.
NOTE: I have tried export to firebase custom ML, I have run this code and didn't get any error
CustomModelDownloadConditions conditions = new CustomModelDownloadConditions.Builder().requireWifi().build();
FirebaseModelDownloader.getInstance().getModel("NewsCheckModel",
DownloadType.LOCAL_MODEL_UPDATE_IN_BACKGROUND, conditions)
.addOnSuccessListener(new OnSuccessListener<CustomModel>() {
#Override
public void onSuccess(CustomModel customModel) {
File modelFile = customModel.getFile();
if (modelFile != null) {
Interpreter interpreter = new Interpreter(modelFile);
}
}
});
I don't know the further steps.
.
.
.
if anyone can help in any way using asset folder or firebase way. I would be very thankful to you
Could you make sure that no compression option is enabled as follows while experimenting on the asset dir case?
android {
// ...
aaptOptions {
noCompress "tflite" // Your model's file extension: "tflite", "lite", etc.
}
}
See more details at this guide page.
There's not much information on your post. It would be useful to know if:
Are you able to deploy it on android?
Does the model initialize?
If yes, Can you perform inference?
If no, what is the exception you get?
In the past, I've had the same problem. So here are some basic steps:
Add Firebase to your project
2a. Make sure you are using the correct dependencies :
They have been updated recently so better follow this guide: here
Basically:
dependencies {
// Import the BoM for the Firebase platform
implementation platform('com.google.firebase:firebase-bom:28.0.1')
// Declare the dependency for the Firebase ML model downloader library
// When using the BoM, you don't specify versions in Firebase library dependencies
implementation 'com.google.firebase:firebase-ml-modeldownloader'
// Also declare the dependency for the TensorFlow Lite library and specify its version
implementation 'org.tensorflow:tensorflow-lite:2.3.0'
}
2b. Add to Manifest:
<uses-permission android:name="android.permission.INTERNET" />
3a. Double check the way you convert your model. Luckily you can convert and deploy to firebase easily:
3b. Convert the model to TensorFlow Lite and upload it to Cloud Storage
source = ml.TFLiteGCSModelSource.from_saved_model('./model_directory')
3c. Create the model object
tflite_format = ml.TFLiteFormat(model_source=source)
model = ml.Model(
display_name="example_model", # This is the name you use from your app to load the model.
tags=["examples"], # Optional tags for easier management.
model_format=tflite_format)
3d. Add the model to your Firebase project and publish it
new_model = ml.create_model(model)
ml.publish_model(new_model.model_id)
3a bis: If your model is already in .tflite:
source = ml.TFLiteGCSModelSource.from_tflite_model_file('example.tflite')
The guide is here
Regarding the inputs/outputs, I can't say much as it depends on your model. Also, be careful with the data types of input and output. Be aware of the type that your model requires (INT32, UINT8, FLOAT32....)
Another important thing is to have some metadata embedded in your model: here
Android Studio uses that metadata to display information when you open a .tflite file.
IMO is very likely that your issue is during your model conversion or lack of metadata.

Use another layer model in .Net Core 3.1

I am a novice in asp .net Core 3.1 programming. Thank you for your help.
I created three layers for my project, one for the core, one for the database and one for the web.
The models are in the ِDTOs folder. Now my problem is to create database tables. I do not have access to the Category model.
How can I solve this problem? I would be grateful if you could guide me in full detail.
The project error image as well as the dependencies on each layer are present in the image.
Due to the problem of uploading photos on the site, I had to upload them to another site
Images link
https://pasteboard.co/JNeXGKJ.jpg
https://pasteboard.co/JNeXsXs.jpg
Your Category class is in the project Pipeland.Core.
Your project Pipeland.Web references Pipeland.Core but your project Pipeland.DataLayer does not.
At the moment, classes in Pipeland.DataLayer (including PipelandContext) can't access any classes in Pipeland.Core (including Category)
Create a project reference to Pipeland.Core in your Pipeland.DataLayer project.
Then add the line:
using Pipeland.Core.Dtos
to the top of your PipelandContext.cs file.
This assumes that your Category class is in the namespace Pipeland.Core.Dtos, which it might not be, but I expect it is.

Getting image from Class Library

I am doing a refactor of my Xamarin project, in which I want to build nuget-packages for my platform specific projects.
And since you can't make your "App.Droid", "App.iOS" and "App.UWP" into nugets I am using class libraries for this.
My problem is when I put my images (ordinary *.png-files) in my UWP-class library it won't work. It is working in both iOS and Android.
So my question is if anyone knows if this is possible, and if so how?
My current setup is as follows:
My UWP-project is named "App.UWP". This is the project i build and the project has the "App.xaml" and "MainPage.xaml".
I then created a "Class library (Universal Windows)" named "Company.Mobile.Core.UWP".
My "App.UWP" is referencing "Company.Mobile.Core.UWP".
I know I have a working connection between the two. My Custom renderers are in the "Company.Mobile.Core.UWP"-project and not in "App.UWP" and is working fine.
Cheers,
Tobias

Cannot find namespace in project oxford name space in sample app of microsoft cognitive services

I am trying to create a simple app that shows near real time emotions with a live web cam. I am using this guide:
https://www.microsoft.com/cognitive-services/en-us/emotion-api/documentation/emotion-api-how-to-topics/HowtoAnazlyzeVideo_Emotion
I've Downloaded the sample app:
https://github.com/Microsoft/Cognitive-Samples-VideoFrameAnalysis/
but I am unsure how I could make it run. the README says:
. Get API keys for the Vision APIs.
2. Open the sample in Visual Studio 2015, build and run the sample applications:
- For BasicConsoleSample, the Face API key is hard-coded directly in BasicConsoleSample/Program.cs.
- For LiveCameraSample, the keys should be entered into the Settings pane of the app. They will be persisted across sessions as user data.
I've got the API keys and inserted the Face API key to the Program.cs code and all of the API's into the settings.
It say's that it cannot find some namespaces as seen in the image:
Why does it say that the namespaces are not included in the Microsoft.ProjectOxford namespace ? Thanks
Edit: This was solved. After updating Nuget and all it still didn't work and the problem was that the pathname was too long.
What I did was downloading the project to desktop and than pressed extract files.
It created a folder with a long name and inside was another folder with a long name so the path was big.
Just put it in D or just extract here and not it will extract the folder inside the zip and not create another one with the folder inside.
You're seeing red squiggles because you're missing some dependent assemblies. These are provided via NuGet, so you should download it by right-clicking on the project, and selecting Manage NuGet packages.... The UI thereafter is hopefully self-explanatory.
Once the missing packages are pulled in from NuGet, you should be able to build+run the application. Once you run it, there should be UI presented where you'd enter the requisite key. The XAML for it is here.

Using flash builder 4.5 for php wizard for remote object

I'm fairly new to Flex\AS3
I'm using flash builder 4.5 for php and I'm trying to connect to my DB via remote objects.
I'm following adobes instructions as listed here:
http://help.adobe.com/en_US/flex/accessingdata/WSbde04e3d3e6474c4-668f02f4120d422cf08-7ffe.html#WSbde04e3d3e6474c4-668f02f4120d422cf08-7ffa
I've created the php service, and successfully finished the wizard.
I've tested my service with the Test tool and it is indeed returning my results.
My problem is that it seems that flash builder didn't create the service's files(super+base) at all. For example, when I drag the service into a dropdown component I get an error saying that the service component can't be found.
Does anyone know this issue happens? how can the test tool work if the service classes don't exist?
Thanks in advance,
Ravid
The problem was that I didn't checkout the files before using the wizard so flash builder didn't have write permissions on the files and therefore didn't create the necessary files.
once he had the write permissions - everything worked just fine

Resources