You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here is my script below!!!
I had trained configs/centermask/centermask_R_50_FPN_lite_res600_ms_bs16_4x.yaml and I wanted to check if I am able to visualize my predictions or not! How should I correct it to get my desired results?
import matplotlib.pyplot as plt
import matplotlib.pylab as pylab
import os
import requests
from io import BytesIO
from PIL import Image
import numpy as np
from maskrcnn_benchmark.config import cfg
from predictor import COCODemo
def load(url):
"""
Given an url of an image, downloads the image and
returns a PIL image
"""
response = requests.get(url)
pil_image = Image.open(BytesIO(response.content)).convert("RGB")
# convert to BGR format
image = np.array(pil_image)[:, :, [2, 1, 0]]
return image
def imshow(img):
plt.imshow(img[:, :, [2, 1, 0]])
val_path='../datasets/val2017/' #this is the validation image data
imglistval = os.listdir(val_path)
for name in imglistval:
imgfile = val_path + name
pil_image = Image.open(imgfile).convert("RGB")
image = np.array(pil_image)[:, :, [2, 1, 0]]
Here is my script below!!!
I had trained configs/centermask/centermask_R_50_FPN_lite_res600_ms_bs16_4x.yaml and I wanted to check if I am able to visualize my predictions or not! How should I correct it to get my desired results?
import matplotlib.pyplot as plt
import matplotlib.pylab as pylab
import os
import requests
from io import BytesIO
from PIL import Image
import numpy as np
from maskrcnn_benchmark.config import cfg
from predictor import COCODemo
config_file = "../configs/centermask/centermask_R_50_FPN_lite_res600_ms_bs16_4x.yaml"
update the config options with the config file
cfg.merge_from_file(config_file)
cfg.MODEL.WEIGHT = '../checkpoints/CenterMask-Lite-R-50-FPN-res600-ms-bs16-4x/model_0070000.pth'
manual override some options
cfg.merge_from_list(["MODEL.DEVICE", "cuda"])
coco_demo = COCODemo(
cfg,
min_image_size=500,
confidence_threshold=0.5,
)
def load(url):
"""
Given an url of an image, downloads the image and
returns a PIL image
"""
response = requests.get(url)
pil_image = Image.open(BytesIO(response.content)).convert("RGB")
# convert to BGR format
image = np.array(pil_image)[:, :, [2, 1, 0]]
return image
def imshow(img):
plt.imshow(img[:, :, [2, 1, 0]])
val_path='../datasets/val2017/' #this is the validation image data
imglistval = os.listdir(val_path)
for name in imglistval:
imgfile = val_path + name
pil_image = Image.open(imgfile).convert("RGB")
image = np.array(pil_image)[:, :, [2, 1, 0]]
The text was updated successfully, but these errors were encountered: