def __init__(self, split, config): # Validate split input if split != 'train' and split != 'val' and split != 'trainval' and split != 'test': raise Exception('Please enter valid split variable!') root = './dataset/VOC2012/' self.img_path = join(root, 'JPEGImages/') self.seg_path = join(root, 'SegmentationClass/') self.split = split img_set = join(root, 'ImageSets/Segmentation/' + split + '.txt') with open(img_set) as f: self.img_list = f.read().rstrip().split('\n') self.num_images = len(self.img_list) self.temp_pointer = 0 # First idx of the current batch self.batch_num = 1 self.max_size = config['max_size'] # Create double side mappings self.gray_to_rgb, self.rgb_to_gray = colormap()
__author = "buyizhiyou" __date = "2018-4-26" #Demo to predict one image,plot results import numpy as np import tensorflow as tf from model import FCN32_test, FCN16_test, FCN8_test from dataloader import Dataloader, Dataloader_small from util import seg_gray_to_rgb, colormap import matplotlib.pyplot as plt import cv2 import pdb import os gray_to_rgb, rgb_to_gray = colormap() # BGR mean pixel value MEAN_PIXEL = np.array([103.939, 116.779, 123.68]) CLASSES = ('__background__', 'aeroplane', 'bicycle', 'bird', 'boat', 'bottle', 'bus', 'car', 'cat', 'chair', 'cow', 'diningtable', 'dog', 'horse', 'motorbike', 'person', 'pottedplant', 'sheep', 'sofa', 'train', 'tvmonitor') config = { 'batch_num': 1, 'iter': 100000, 'num_classes': 21, 'max_size': (640, 640), 'weight_decay': 0.0005, 'base_lr': 0.001,