Datasets:

Modalities:
Text
Libraries:
Datasets
License:

Figure out how to consistently match images, albums, etc after deduping.

#4
by cdleong - opened
SIL Global - AI org

#2 talks about this. Essentially the albums, images, annotations aren't consistently matching with each other after our deduping efforts.

I think someone needs to:
start with bloom_vist_june15.json at https://bloom-vist.s3.amazonaws.com/bloom_vist_june15.json
follow some of the album_ids mentioned above through the pipeline https://github.com/sil-ai/bloom-parsing/tree/main/emnlp_pipeline
figure out what happened to get us to https://bloom-vist.s3.amazonaws.com/bloom_vist_june15_deduped_june21_langfiltered_june22_with_storylets_licenseupdated.json, and whether the deduping is messed up or it's just my loading script code is messed up.
And then the loading script needs to updated.

SIL Global - AI org

This one blocks #3 and #2

SIL Global - AI org
edited Nov 7, 2022

266a9fcf-4e32-4c4b-aae2-b04bc39a29e9 is one I'm debugging.

  • There are 33 images with this album ID in the latest JSON .
  • There are 22 annotations with this album ID
  • There are 2 stories with this album ID
  • The album itself claims to have 11 photos
SIL Global - AI org

searching the duplicate_ids_list shows

"266a9fcf-4e32-4c4b-aae2-b04bc39a29e9": [
    "49287e44-4ed1-4edb-a543-2245550c9173",
    "2047903f-49b6-4a8a-8aed-2e776313b0e6"
  ],
SIL Global - AI org

OK, so it looks like we originally had 3 albums, each with 11 images.
Somehow the images had their album IDs all edited to point to the "winner" album, but the URLs were left in place maybe?
And the 2 stories match the two sets of 11 annotations?

SIL Global - AI org
edited Nov 7, 2022

OK, I think I need to develop a way to interactively search this thing. An app or script that will let you put in an album ID and see what's associated.

Just to refresh myself, the bloom_vist_june15 format has

$ python get_json_top_level_keys.py data/bloom_vist_june15.json 
data/bloom_vist_june15.json
albums: <class 'list'>: 9895 items
images: <class 'list'>: 91190 items
annotations: <class 'list'>: 140362 items
utc_creation_date: 2022-06-15 22:25:10.814397

And the most recent JSON looks like:

$ python get_json_top_level_keys.py data/bloom_vist_june15_deduped_june21_langfiltered_june22_with_storylets_licenseupdated.json
data/bloom_vist_june15_deduped_june21_langfiltered_june22_with_storylets_licenseupdated.json
utc_creation_date: 2022-06-21 18:51:02
duplicate_ids_list: <class 'dict'>: 7520 items, 7520 keys
albums: <class 'list'>: 7520 items
images: <class 'list'>: 91190 items
annotations: <class 'list'>: 114359 items
stories: <class 'dict'>: 11548 items, 11548 keys
last_filter_date: <class 'list'>: 1 items
licenses updated: <class 'list'>: 1 items

Some sample outputs:

$ jq .albums[0] data/bloom_vist_june15.json
{
  "title": "پر وخت پابندي",
  "photos": "3",
  "id": "ed7eb6e9-fef2-4f01-bd0b-803b4bc8eb22",
  "license": "cc0",
  "metadata_from_original_json": { REALLY LONG AND DETAILED }
}

$ jq .annotations[0] data/bloom_vist_june15.json
[
  {
    "album_id": "ed7eb6e9-fef2-4f01-bd0b-803b4bc8eb22",
    "photo_flickr_id": "9d6fdf53-ece6-42b5-84a0-833d49c7f5de",
    "story_id": "ccb7fef2-4f13-4d3c-a03d-eeb34149c9c6",
    "worker_arranged_photo_order": 0,
    "text": "ښوونکې ورته وویل: کریمه!\nولې دې درس نه دی زده.",
    "lang": "pbt"
  }
]


$ jq .images[0] data/bloom_vist_june15.json
{
  "album_id": "ed7eb6e9-fef2-4f01-bd0b-803b4bc8eb22",
  "url_o": "https://bloom-vist.s3.amazonaws.com/%D9%BE%D8%B1+%D9%88%D8%AE%D8%AA+%D9%BE%D8%A7%D8%A8%D9%86%D8%AF%D9%8A/41.jpg",
  "local_image_path": "پر وخت پابندي/41.jpg",
  "media": "photo",
  "id": "9d6fdf53-ece6-42b5-84a0-833d49c7f5de"
}

Some sample outputs from the latest one:


{
  "title": "پر وخت پابندي",
  "photos": "3",
  "id": "ed7eb6e9-fef2-4f01-bd0b-803b4bc8eb22",
  "license": "cc-by-nc",
  "metadata_from_original_json": {BIG LONG THING}
}

$ jq .annotations[0] data/bloom_vist_june15_deduped_june21_langfiltered_june22_with_storylets_licenseupdated.json
[
  {
    "album_id": "ed7eb6e9-fef2-4f01-bd0b-803b4bc8eb22",
    "photo_flickr_id": "9d6fdf53-ece6-42b5-84a0-833d49c7f5de",
    "story_id": "ccb7fef2-4f13-4d3c-a03d-eeb34149c9c6",
    "worker_arranged_photo_order": 0,
    "text": "ښوونکې ورته وویل: کریمه!\nولې دې درس نه دی زده.",
    "lang": "pbt",
    "storylet_id": "604987eb-327f-3d49-80a7-bd8afc482d57"
  }
]


$ jq .images[0] data/bloom_vist_june15_deduped_june21_langfiltered_june22_with_storylets_licenseupdated.json
{
  "album_id": "ed7eb6e9-fef2-4f01-bd0b-803b4bc8eb22",
  "url_o": "https://bloom-vist.s3.amazonaws.com/%D9%BE%D8%B1+%D9%88%D8%AE%D8%AA+%D9%BE%D8%A7%D8%A8%D9%86%D8%AF%D9%8A/41.jpg",
  "local_image_path": "پر وخت پابندي/41.jpg",
  "media": "photo",
  "id": "9d6fdf53-ece6-42b5-84a0-833d49c7f5de"
}

$ jq .stories data/bloom_vist_june15_deduped_june21_langfiltered_june22_with_storylets_licenseupdated.json|head -n30
{
  "ccb7fef2-4f13-4d3c-a03d-eeb34149c9c6": {
    "album_id": "ed7eb6e9-fef2-4f01-bd0b-803b4bc8eb22",
    "bloom_lang": "pbt",
    "filter_methods": {
      "expected_scripts": {
        "expected_scripts": [
          "Arab"
        ],
        "match_threshold": 0.95,
        "quarantine_result": false
      }
    },
    "quarantine": false
  },
  "670fd2d9-8e96-4f08-8744-f23cc39b15bc": {
    "album_id": "ef8d5b77-dcc9-4600-be6b-c7ee2c5c0e46",
    "bloom_lang": "en",
    "filter_methods": {
      "expected_scripts": {
        "expected_scripts": [
          "Brai",
          "Latn",
          "Shaw",
          "Dsrt",
          "Dupl"
        ],
        "match_threshold": 0.95,
        "quarantine_result": false
      }

SIL Global - AI org

What would be really helpful: something that lets me specify an album ID, and it will show me the images and annotations associated with that, as well as the album metadata.

SIL Global - AI org

Like, I want to see the images.

SIL Global - AI org

Giving Streamlit a go.

SIL Global - AI org

Created a nice app that lets me select an album ID from either JSON and visualize.
https://huggingface.co/spaces/sil-ai/explore_vist

SIL Global - AI org

In the original https://bloom-vist.s3.amazonaws.com/bloom_vist_june15.json, we've got three album IDs.
"266a9fcf-4e32-4c4b-aae2-b04bc39a29e9" which has 11 images and 22 annotations in en and ru
"49287e44-4ed1-4edb-a543-2245550c9173" which has 11 images and 11 annotations, but those 11 are the same 11 from the en set above.
"2047903f-49b6-4a8a-8aed-2e776313b0e6" has 11 images and 22 annotations in ky and en. The en ones are again, duplicates of the ones above.
So what we WANT is to end up with 1 set of 11 images, and 3 sets of 11 annotations in ru, ky, and en.
What we actually have is 33 images, and only 22 annotations. We lost the ky ones.

SIL Global - AI org
edited Nov 7, 2022

Searching the latest JSON for the ky album:

$ jq . data/bloom_vist_june15_deduped_june21_langfiltered_june22_with_storylets_licenseupdated.json|grep --context=10 "2047903f-49b6-4a8a-8aed-2e776313b0e6"

shows me that it's in the stories list, story ID 0459d52e-22c9-46cb-bce5-409f5392d287, not quarantined.

Also annotations do exist, pointing to album ID "2047903f-49b6-4a8a-8aed-2e776313b0e6".

Example annotation:

    [
      {
        "album_id": "2047903f-49b6-4a8a-8aed-2e776313b0e6",
        "photo_flickr_id": "4b208723-a1b0-461b-a1dc-7bd68d04ccd7",
        "story_id": "0459d52e-22c9-46cb-bce5-409f5392d287",
        "worker_arranged_photo_order": 9,
        "text": "Вангари көп жылдар бою билимин өркүндөтүп, иштей берди. Дүйнө эли анын иштерине кызыга баштады.\nИйгилик деп ушуну айткыла! Ал бүткүл дүйнөлүк Нобель сыйлыгына көрсөтүлдү. Африкадан бул сыйлык ыйгарылган алгачкы айым Вангари Маатаи болду.",
        "lang": "ky",
        "storylet_id": "21f373b5-827a-320d-a1fe-96feceaed321"
      }
    ],
SIL Global - AI org
edited Nov 7, 2022

Things we need to do:

  • check for annotations with no matching album in albums.
  • check for images with no matching annotations associated with the album that they're associated with.
  • fix the JSON so that everything pointing to a nonexistent album gets updated to point to an existing one.
  • that would let us then make progress on all the other issues for this dataset, like #2 and #3

Sign up or log in to comment