<jupyter_start><jupyter_text>test mask image<jupyter_code>test_mask_dir_path="/home/jupyter/dataset/mask/val/"
test_mask_dir=os.listdir(test_mask_dir_path)
mask_files = [f for f in glob.glob(test_mask_dir_path + "**/*color.png", recursive=True)]
print("number of mask file :::",len(mask_files))
mask_files.sort()
mask_files[466]
gray_img=[]
for i in mask_files:
    mask_arr=imageio.imread(i)
    gray_arr=cv2.cvtColor(mask_arr, cv2.COLOR_BGR2GRAY)
    gray_img.append(gray_arr)
    #gray_img.append(resize(gray_arr,(512,512),preserve_range=True))
gray_img=np.array(gray_img)
gray_img.shape
plt.imshow(gray_img[91])
json_file=[f for f in glob.glob(test_mask_dir_path + "**/*.json", recursive=True)]
print("number of json file :::",len(json_file))
json_file.sort()
json_file[132]
json_array=[]
for i in json_file:
        json_array.append(json.load(open(i)))
new_mask_array=[]
c=0
for j in gray_img:
    for i in json_array[c]["objects"]:
        if(i['label']=='vegetation'):
            temp1=cv2.fillPoly(j,[np.asarray(i["polygon"],dtype=np.int32)],255)
        else:
            temp1=cv2.fillPoly(j,[np.asarray(i["polygon"],dtype=np.int32)],0)
    temp1[temp1!=255]=0
    new_mask_array.append(temp1)
    c=c+1
new_mask_array=np.array(new_mask_array)
#new_mask_array=np.reshape(new_mask_array,(new_mask_array.shape[0],new_mask_array.shape[1],new_mask_array.shape[2],1))
mask_final_arr=[]
for image in new_mask_array:
    mask_final_arr.append(resize(image,(512,512),preserve_range=True))
mask_final_arr=np.array(mask_final_arr)
mask_final_arr.shape
np.save('test_real_mask.npy',mask_final_arr)
plt.imshow()
# son test 
new_mask_array=[]
temp1=[]
for i in json_array[466]["objects"]:
    if(i['label']=='vegetation'):
        temp1=cv2.fillPoly(gray_arr,[np.asarray(i["polygon"],dtype=np.int32)],255)
temp1[temp1!=255]=0
new_mask_array.append(temp1)
mask_arr=imageio.imread(mask_files[466])
gray_arr=cv2.cvtColor(mask_arr, cv2.COLOR_BGR2GRAY)
gray_arr=np.array(gray_arr)
gray_arr.shape<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.16245666171371967, 'fraction_numerical': 0.03566121842496285, 'mean_word_length': 7.047808764940239, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '592110', 'license': 'MIT', 'n_tokens_mistral': 870, 'n_tokens_neox': 832, 'n_words': 98, 'path': 'test/test_image_code.ipynb', 'repo_name': 'anant1203/Applying-Deep-Learning-for-Large-scale-Quantification-of-Urban-Tree-Cover', 'size': '2019'}