Solution to identify "Similar Product Images"? - azure

I want to build a cloud based solution in which I would give a pool of images; and then ask for "find similar image to a particular image from this pool of images" !! Pool of images can be like "all t-shirt" images. Hence, similar images mean "t-shirt with similar design/color/sleeves" etc.
Tagging solution won't work as they are at very high level.
AWS Rekognition gives "facial similarities" .. but not "product similarities" .. it does not work like for images of dresses..
I am open to use any cloud providers; but all are providing "tags" of the image which won't help me.
One solution could be that I use some ML framework like MXNet/Tensorflow, create my own models, train them and then use.. But is there any other ready made solution on any of cloud providers ?

ibm-bluemix has an api to find similar images https://www.ibm.com/watson/developercloud/visual-recognition/api/v3/#find_similar

Using the Azure Cognitive Services (Computer Vision to be more precise) you can get categories, tags, a caption and even more info for images. Processing all your images would provide tags for your image pool. And that enables you to get similar images based on (multiple) identical tags.
This feature returns information about visual content found in an image. Use tagging, descriptions, and domain-specific models to identify content and label it with confidence. Apply the adult/racy settings to enable automated restriction of adult content. Identify image types and color schemes in pictures.
An example of (part of) a result of the Computer Vision API:
Description{
"Tags": [
"train",
"platform",
"station",
"building",
"indoor",
"subway",
"track",
"walking",
"waiting",
"pulling",
"board",
"people",
"man",
"luggage",
"standing",
"holding",
"large",
"woman",
"yellow",
"suitcase"
],
"Captions": [
{
"Text": "people waiting at a train station",
"Confidence": 0.8331026
}
]
}
Tags[
{
"Name": "train",
"Confidence": 0.9975446
},
{
"Name": "platform",
"Confidence": 0.995543063
},
{
"Name": "station",
"Confidence": 0.9798007
},
{
"Name": "indoor",
"Confidence": 0.927719653
},
{
"Name": "subway",
"Confidence": 0.838939846
},
{
"Name": "pulling",
"Confidence": 0.431715637
}
]

You could also use the Bing Image Search API (https://azure.microsoft.com/en-us/services/cognitive-services/bing-image-search-api/) which allows you to do an image search based on specified criteria within your solution...

You could use a combination of things here. Use an image tagging service aws rekognition, or any of those listed above) then create some training data with like images, and upload that into something like aws machine learning. This is a bit similar to what has been brought up earlier, however I am trying to elucidate that while tagging might not be the end all be all of your solution, it will likely play a role as a first to step to a more complex process.

pls check the site http://cloudsight.ai/api, and try the demo. the sample result would be
{
"token": "BBKA0lW9O-B2eamXUysdXA",
"url": "http://assets.cloudsight.ai/uploads/image_request/image/314/314978/314978186/79379_86cb4e2611d6b0a3287a926a1ca1fe51_image1_zoom.jpg",
"ttl": 54,
"status": "completed",
"name": "men's red and black checkered button-up shirt"
}
{
"token": "bjX7nWGs0toajIDwyvXxlw",
"url": "http://assets.cloudsight.ai/uploads/image_request/image/314/314987/314987168/11.jpg",
"ttl": 54,
"status": "completed",
"name": "blue, gray and navy blue stripe crew-neck T-shirt"
}

Related

Display one colour option on Shopify product page

I'm trying to display only one colour variant of my product at any time when one is selected.
I can get it to work when I manually assign an image to each of the product colours, but when I upload a new .CSV, this is overwritten. Since there are going to be hundreds of products on this store, this isn't a viable solution.
Any help would be greatly appreciated. Thank you.
Link to .CSV
https://docs.google.com/spreadsheets/d/1trq0X3MjR-n2THFnT8gYYlwKscnQavCeeZ8L-ifYaHw/edit?usp=sharing
Link to Product page
https://tomgarrad.myshopify.com/products/lightweight-trainers?variant=37878137356461
Use the Shopify API instead of uploading from a spreadsheet. It allows you to do a lot of things, the following code would upload a product:
POST /admin/api/2021-01/products.json
{
"product": {
"title": "Lightweight Trainers",
"body_html": "<strong>Great trainers!</strong>", #Description
"vendor": "Tom", #The name of the products vendor
"product_type": "Trainer",
"variants": [
{
"option1": "Blue",
"price": "10.00",
"sku": "123" #code
},
{
"option2": "Red",
"price": "10.00",
"sku": "123"
}
],
"images": [
{
"attachment": "R0lGODlhAQABAIAAAAAAAAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==\n"
}
]
}
}
The image attachment is base64 encoded so keep that in mind when uploading images. Shopify has a very detailed documentation of their API and it's easy to setup. Hopefully this will work for you.

Cannot scrape google play reviews by using url "https://play.google.com/store/getreviews" by post request

I tried every code available in internet for scraping google playstore. The url "https://play.google.com/store/getreviews" worked for 1 day. It is not working now. I'm getting 404 error.
Please help
You could try a third-party solution like SerpApi. We handle proxies, solve captchas, and parse all rich structured data for you.
With this API you can retrieve up to 199 reviews per page, and then use next_page_token to get the rest.
Example python code for retrieving YouTube reviews (available in other libraries also):
from serpapi import GoogleSearch
params = {
"api_key": "SECRET_API_KEY",
"engine": "google_play_product",
"store": "apps",
"gl": "us",
"product_id": "com.google.android.youtube",
"all_reviews": "true"
}
search = GoogleSearch(params)
results = search.get_dict()
Example JSON output:
"reviews": [
{
"title": "Qwerty Jones",
"avatar": "https://play-lh.googleusercontent.com/a/AATXAJwSQC_a0OIQqkAkzuw8nAxt4vrVBgvkmwoSiEZ3=mo",
"rating": 3,
"snippet": "Overall a great app. Lots of videos to see, look at shorts, learn hacks, etc. However, every time I want to go on the app, it says I need to update the game and that it's \"not the current version\". I've done it about 3 times now, and it's starting to get ridiculous. It could just be my device, but try to update me if you have any clue how to fix this. Thanks :)",
"likes": 586,
"date": "November 26, 2021"
},
{
"title": "matthew baxter",
"avatar": "https://play-lh.googleusercontent.com/a/AATXAJy9NbOSrGscHXhJu8wmwBvR4iD-BiApImKfD2RN=mo",
"rating": 1,
"snippet": "App is broken, every video shows no dislikes even after I hit the button. I've tested this with multiple videos and now my recommended is all messed up because of it. The ads are longer than the videos that I'm trying to watch and there is always a second ad after the first one. This app seriously sucks. I would not recommend this app to anyone.",
"likes": 352,
"date": "November 28, 2021"
},
{
"title": "Operation Blackout",
"avatar": "https://play-lh.googleusercontent.com/a-/AOh14GjMRxVZafTAmwYA5xtamcfQbp0-rUWFRx_JzQML",
"rating": 2,
"snippet": "YouTube used to be great, but now theyve made questionable and arguably stupid decisions that have effectively ruined the platform. For instance, you now have the grand chance of getting 30 seconds of unskipable ad time before the start of a video (or even in the middle of it)! This happens so frequently that its actually a feasible option to buy an ad blocker just for YouTube itself... In correlation with this, YouTube is so sensitive twords the public they decided to remove dislikes. Why????",
"likes": 370,
"date": "November 24, 2021"
},
...
],
"serpapi_pagination": {
"next": "https://serpapi.com/search.json?all_reviews=true&engine=google_play_product&gl=us&hl=en&next_page_token=CpEBCo4BKmgKR_8AwEEujFG0VLQA___-9zuazVT_jmsbmJ6WnsXPz8_Pz8_PxsfJx5vJns3Gxc7FiZLFxsrLysnHx8rIx87Mx8nNzsnLyv_-ECghlTCOpBLShpdQAFoLCZiJujt_EovhEANgmOjCATIiCiAKHmFuZHJvaWRfaGVscGZ1bG5lc3NfcXNjb3JlX3YyYQ&product_id=com.google.android.youtube&store=apps",
"next_page_token": "CpEBCo4BKmgKR_8AwEEujFG0VLQA___-9zuazVT_jmsbmJ6WnsXPz8_Pz8_PxsfJx5vJns3Gxc7FiZLFxsrLysnHx8rIx87Mx8nNzsnLyv_-ECghlTCOpBLShpdQAFoLCZiJujt_EovhEANgmOjCATIiCiAKHmFuZHJvaWRfaGVscGZ1bG5lc3NfcXNjb3JlX3YyYQ"
}
Check out the documentation for more details.
Test the search live on the playground.
Disclaimer: I work at SerpApi.

List Template for FB using Bot framework node.js V4

Can anyone please help me to include list view in Facebook Channel using Bot framework? I saw examples as shown here List template. I don't know whether this is the exact way in which we need to give the attachments. Also I didn't know the equivalent for sourceEvent method in Bot framework v4. Another useful link is as follows FB Messenger Message Template. See the image given below. I need to put the link for the image and once we click the link it should open another page also the image should be clickable image as in the example for C# Clickable HeroCard images using tap property. Both functionality should work. I tried using HeroCard (but the url that needs to open-up had CORS origin issue. I tried using Adaptive card but it is not supported in Facebook as of now. So, I thought to use List Template for Facebook. Is there anyway to achieve this?
You can send Facebook List Templates through the Microsoft BotFramework by adding the Facebook attachment to the activity's channel data. The list template type doesn't seem to be supported, but you can set the type to generic and add multiple elements to the attachment to get the same result. See the example below.
await turnContext.sendActivity({
channelData: {
"attachment": {
"type": "template",
"payload": {
"template_type": "generic",
"elements": [
{
"title": "Three Strategies for Finding Snow",
"subtitle": "How do you plan a ski trip to ensure the best conditions? You can think about a resort’s track record, or which have the best snow-making machines. Or you can gamble.",
"image_url": "https://static01.nyt.com/images/2019/02/10/travel/03update-snowfall2/03update-snowfall2-jumbo.jpg?quality=90&auto=webp",
"default_action": {
"type": "web_url",
"url": "https://www.nytimes.com/2019/02/08/travel/ski-resort-snow-conditions.html",
"messenger_extensions": false,
"webview_height_ratio": "tall"
},
"buttons": [{
"type":"element_share"
}]
},
{
"title": "Viewing the Northern Lights: ‘It’s Almost Like Heavenly Visual Music’",
"subtitle": "Seeing the aurora borealis has become a must-do item for camera-toting tourists from Alaska to Greenland to Scandinavia. On a trip to northern Sweden, the sight proved elusive, if ultimately rewarding.",
"image_url": "https://static01.nyt.com/images/2019/02/17/travel/17Northern-Lights1/17Northern-Lights1-superJumbo.jpg?quality=90&auto=webp",
"default_action": {
"type": "web_url",
"url": "https://www.nytimes.com/2019/02/11/travel/northern-lights-tourism-in-sweden.html",
"messenger_extensions": false,
"webview_height_ratio": "tall"
},
"buttons": [{
"type":"element_share"
}]
},
{
"title": "Five Places to Visit in New Orleans",
"subtitle": "Big Freedia’s rap music is a part of the ether of modern New Orleans. So what better authentic travel guide to the city that so many tourists love to visit?",
"image_url": "https://static01.nyt.com/images/2019/02/17/travel/17NewOrleans-5Places6/17NewOrleans-5Places6-jumbo.jpg?quality=90&auto=webp",
"default_action": {
"type": "web_url",
"url": "https://www.nytimes.com/2019/02/12/travel/big-freedia-five-places-to-eat-and-visit-in-new-orleans.html",
"messenger_extensions": false,
"webview_height_ratio": "tall"
},
"buttons": [{
"type":"element_share"
}]
}]
}
}
}
});
Hope this helps!

My model can't find any entities

I'm testing NLP tools and right now I'm facing a problem with Rasa NLU.
With API.AI, Wit.ai and LUIS.AI I could find the entities I want with no more than 8-10 examples. With Rasa, on the other hand, I already have 18 examples and I could never find an entity. Even if my query matches exactly one of my examples, I still have an empty entities array as the result.
I'm using Rasa with the recommended Docker instance and my current pipeline is ["nlp_spacy", "tokenizer_spacy", "intent_featurizer_spacy", "ner_crf", "ner_synonyms", "intent_classifier_sklearn" and "ner_duckling"].
I specify my project and my model within my query, like this:
localhost:5000/parse?q=my_sentence&project=my_project&model=my_model
Any useful information is appreciated.
Thank you!
Update with examples
{
"text": "How can I make a carrot cake?",
"intent": "AskRecipe",
"entities": [
{
"start": 17,
"end": 27,
"value": "carrot cake",
"entity": "recipe"
}
]
},
{
"text": "What do I need to make a Lemon Pie?",
"intent": "AskRecipe",
"entities": [
{
"start": 25,
"end": 33,
"value": "Lemon Pie",
"entity": "recipe"
}
]
},
{
"text": "What do I need to make brownies?",
"intent": "AskRecipe",
"entities": [
{
"start": 23,
"end": 30,
"value": "brownies",
"entity": "recipe"
}
]
}
Then when I try, for instance, to extract information from "What do I need to make brownies?" (which is also listed as a example) this is the result:
{"entities": [], "intent": {"confidence": 0.8870822891508189, "name": "AskRecipe"}, "text": "What do I need to make brownies?", "intent_ranking": [{"confidence": 0.8870822891508189, "name": "AskRecipe"}, {"confidence": 0.11291771084918109, "name": "greet"}]}
I tried many other examples, but none of them worked.
I solved this problem.
In my config.json file, I updated my pipeline value to "scapy_sklearn" as opposed to ["nlp_spacy", "tokenizer_spacy", "intent_featurizer_spacy", "ner_crf", "ner_synonyms", "intent_classifier_sklearn" and "ner_duckling"].
Also, I restarted my docker instance after I trained a new model.
I must say, though, the docker instance with which I succeeded is not the same as the one I was using when I posted this issue, so, honestly, I can't be 100% sure I didn't break any configuration before - although I believe I didn't.
I hope this helps someone :)
I had the same issue of Rasa not recognizing entities. I see you've solved the issue in a different way, I'll just add what worked for me cos I see the same mistake I made, in the examples posted -
The end value must be ('start' index) + (length of 'value') so it should be every 'end' value shown here +1.
I know it's very simple, but it worked for me.

Elastic opposite query

I'm using elastic search for classic queries LIKE "search all documents with G4 in name and LG in manfucaturer". This is ok. But what if I have a lot of documents and database with lot of search terms and I need to know which documents match some specific multicolumn terms. For example:
Documents:
[
{
"id": 5787,
"name": "Smartphone G4",
"manufacturer": "LG",
"description": "The revolutionary LG G4 design can only be described as forward thinking—with a classic touch."
},
{
"id": 68779,
"name": "Smartphone S6",
"manufacturer": "Samsung",
"description": "The Samsung Galaxy S6 is powerful to use and beautiful to behold."
}
]
...
Terms:
[
{
"id": "587",
"name": "G4",
"manufacturer": "LG",
"description": "classic touch"
},
{
"id": "364",
"manufacturer": "Samsung",
"description": "galaxy s6"
}
]
...
Result:
{
"587": [5787],
"364": [68779]
}
OR:
{
"5787": [587],
"68779": [364]
}
I need list of documents and list of terms which corresponds them (or oposite). In small amount of terms, it should be possible to apply all rules one by one and save matching documents. But I have milions of documents and thousands of terms. So, it is not possible to aply them one by one. Is it possible in another way?
https://www.elastic.co/guide/en/elasticsearch/reference/current/search-percolate.html is exactly what I wanted. It can store your queries and execute them against documents.

Resources