Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Images and Videos tag response inconsistency #10

Open
tkrajina opened this issue Aug 17, 2016 · 0 comments
Open

Images and Videos tag response inconsistency #10

tkrajina opened this issue Aug 17, 2016 · 0 comments

Comments

@tkrajina
Copy link

tkrajina commented Aug 17, 2016

I have some problems with this library when getting tags for videos. The problem is this:

This is an example response from the tag endpoint for a .mp4 video:

{
    "results": [
        {
            "result": {
                    "classes": [
                        [
                            "no person",
                            "indoors",

And this is a response for an image:

{
    "results": [
        {
            "result": {
                "tag": {
                    "classes": [
                        "keyboard",

The classes field is an array of strings for images, but an array of an array of strings for videos.

This is the diff which fixes the video responses:

diff --git a/requests.go b/requests.go
index 22fdb06..96bb70b 100644
--- a/requests.go
+++ b/requests.go
@@ -56,9 +56,9 @@ type TagResult struct {
        LocalID       string   `json:"local_id"`
        Result        struct {
                Tag struct {
-                       Classes []string  `json:"classes"`
+                       Classes [][]string  `json:"classes"`
                        CatIDs  []string  `json:"catids"`
-                       Probs   []float32 `json:"probs"`
+                       Probs   [][]float32 `json:"probs"`
                }
        }
        DocIDString string `json:"docid_str"`

But this will break the image tag response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant