import cityscapesscripts.evaluation.instances2dict_with_polygons as cs
I can't not find "instances2dict_with_polygons" in this repo or cityscapesscripts repo. Does anyone know where to find it? Thanks.
Hi @jianminsun, thanks for reporting the missing file. We will release it with the Cityscapes models and training instructions (please see issue #27 which tracks this).
In the meantime, you can obtain the instnaces2dict_with_polygons.py script by applying the following changes to the instances2dict.py script from the Cityscapes repo:
$ diff instances2dict.py instances2dict_with_polygons.py
--- instances2dict.py 2018-02-06 05:19:33.009812039 -0800
+++ instances2dict_with_polygons.py 2018-02-06 05:22:15.953031446 -0800
@@ -11,7 +11,9 @@
sys.path.append( os.path.normpath( os.path.join( os.path.dirname( __file__ ) , '..' , 'helpers' ) ) )
from csHelpers import *
-def instances2dict(imageFileList, verbose=False):
+import cv2
+
+def instances2dict_with_polygons(imageFileList, verbose=False):
imgCount = 0
instanceDict = {}
@@ -35,9 +37,22 @@
# Loop through all instance ids in instance image
for instanceId in np.unique(imgNp):
+ if instanceId < 1000:
+ continue
+
instanceObj = Instance(imgNp, instanceId)
+ instanceObj_dict = instanceObj.toDict()
- instances[id2label[instanceObj.labelID].name].append(instanceObj.toDict())
+ if id2label[instanceObj.labelID].hasInstances:
+ mask = (imgNp == instanceId).astype(np.uint8)
+ contour, hier = cv2.findContours(
+ mask.copy(), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_NONE)
+
+ polygons = [c.reshape(-1).tolist() for c in contour]
+ instanceObj_dict['contours'] = polygons
+
+ instances[id2label[instanceObj.labelID].name].append(
+ instanceObj_dict)
imgKey = os.path.abspath(imageFileName)
instanceDict[imgKey] = instances
import cityscapesscripts.evaluation.instances2dict_with_polygons as cs
I can't not find "instances2dict_with_polygons" in this repo or cityscapesscripts repo. Does anyone know where to find it? Thanks.
Hi! Recently, I have trained a model on Cityscapes dataset. However, the perforamce is half the result reported by paper. Did that happen to you?
@ir413 @lssily can you just share the generated json files for cityscapes?
import cityscapesscripts.evaluation.instances2dict_with_polygons as cs
I can't not find "instances2dict_with_polygons" in this repo or cityscapesscripts repo. Does anyone know where to find it? Thanks.Hi! Recently, I have trained a model on Cityscapes dataset. However, the perforamce is half the result reported by paper. Did that happen to you?
Did you solve the problem, I also meet the problem of the val accuracy problem. It is too low to match the results in paper.
Sorry I don't really understand this part of convert_cityscapes_to_coco.py:
`
def convert_cityscapes_instance_only(
data_dir, out_dir):
"""Convert from cityscapes format to COCO instance seg format - polygons"""
sets = [
'gtFine_val',
# 'gtFine_train',
# 'gtFine_test',
# 'gtCoarse_train',
# 'gtCoarse_val',
# 'gtCoarse_train_extra'
]
ann_dirs = [
'gtFine_trainvaltest/gtFine/val',
# 'gtFine_trainvaltest/gtFine/train',
# 'gtFine_trainvaltest/gtFine/test',
# 'gtCoarse/train',
# 'gtCoarse/train_extra',
# 'gtCoarse/val'
]
`
I don't understand how I should organize the directory for dataset. What is the correct way to perform this code?
Can anyone share the generated json files for cityscapes?
Why not just given that file..... what does these diff can applying for
Most helpful comment
Hi @jianminsun, thanks for reporting the missing file. We will release it with the Cityscapes models and training instructions (please see issue #27 which tracks this).
In the meantime, you can obtain the
instnaces2dict_with_polygons.pyscript by applying the following changes to theinstances2dict.pyscript from the Cityscapes repo: