GithubHelp home page GithubHelp logo

Comments (5)

kevinj22 avatar kevinj22 commented on July 3, 2024 3

--input_json_file "panoptic_train2017.json"
--segmentations_folder "stuff_train2017_pixelmaps"
--output_json_file "my_folder"
--categories_json_file "~/panopticapi/panoptic_coco_categories.json"
--things_only

Your argument is things only but your segmentation PNG's are for stuff. Perhaps this is the issue?

If so set your segmentations_folder to the results of unzipping the panoptic_train2017.zip file.

Another guess would be to adjust the popping of the color category attribute here:

for category in d_coco['categories']:
        if things_only and category['isthing'] != 1:
            continue
        category.pop('isthing')

        try:
            category.pop('color')
        except:
            pass

        categories_coco_detection.append(category)
    d_coco['categories'] = categories_coco_detection

The key error at this point in time indicates to me there is no need to remove the 'color' key of the current category dictionary. Thus I wrapped it in a try / except block.

from panopticapi.

Loerbri avatar Loerbri commented on July 3, 2024

Thank you very much. I was indeed reading from the wrong segmentation folder.

from panopticapi.

ranjiewwen avatar ranjiewwen commented on July 3, 2024

i meet another problem int panoptic2detection_coco_format.py funtion : convert_panoptic_to_detection_coco_format() as follow:

    with open(output_json_file, 'w') as f:
        json.dump(d_coco, f)

display error:

   raise TypeError(repr(o) + " is not JSON serializable")
TypeError: b'0b7i51O001O1O1O2N4L2N00000000000000N2N2M3N200O100

i use python3.5 ; i have looked up some information and didn't solve it ; can you help ? thanks!

from panopticapi.

kevinj22 avatar kevinj22 commented on July 3, 2024

I'm not sure about this but try json.dumps(d_coco_). dumps is for strings I believe: https://realpython.com/python-json/

from panopticapi.

ranjiewwen avatar ranjiewwen commented on July 3, 2024

i meet another problem int panoptic2detection_coco_format.py funtion : convert_panoptic_to_detection_coco_format() as follow:

    with open(output_json_file, 'w') as f:
        json.dump(d_coco, f)

display error:

   raise TypeError(repr(o) + " is not JSON serializable")
TypeError: b'0b7i51O001O1O1O2N4L2N00000000000000N2N2M3N200O100

i use python3.5 ; i have looked up some information and didn't solve it ; can you help ? thanks!

  • thanks: sover my problem : #7
  • 'counts' is returned as binary in Python 3, decode it into a UTF8 string
  for segm_info in annotation['segments_info']:
            if things_only and categories[segm_info['category_id']]['isthing'] != 1:
                continue
            mask = (pan == segm_info['id']).astype(np.uint8)
            mask = np.expand_dims(mask, axis=2)
            mask=COCOmask.encode(np.asfortranarray(mask))[0]
            # 'counts' is returned as binary in Python 3, decode it into a UTF8 string
            mask['counts'] = mask['counts'].decode('utf8')

            segm_info.pop('id')
            segm_info['image_id'] = annotation['image_id']
            segm_info['segmentation'] = mask
            annotations_detection.append(segm_info)
  • best way to solve problem: use python2

from panopticapi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.