def _read_pkgconfig_changes(self): pkgconfig = {} files = FileUtils() files.open_datafile(PKGCONFIG_CONVERSIONS) for line in files.f: # the values are split by ': ' pair = line.split(': ') pkgconfig[pair[0]] = pair[1][:-1] files.close() return pkgconfig
def _read_licenses_changes(self): licenses = {} files = FileUtils() files.open_datafile(LICENSES_CHANGES) for line in files.f: # strip newline line = line.rstrip('\n') # file has format # correct license string<tab>known bad license string # tab is used as separator pair = line.split('\t') licenses[pair[1]] = pair[0] files.close() return licenses
def _find_macros_with_arg(self, spec): """ Load argumented macros from specfile """ macrofuncs = [] files = FileUtils() files.open(spec, 'r') for line in files.f: line = line.rstrip('\n') found_macro = self.re_spec_macrofunc.sub(r'\1', line) if found_macro != line: macrofuncs += [ found_macro ] files.close() return macrofuncs
def _load_keywords_whitelist(self): """ Create regexp for the unbrace keywords based on rpm showrc and whitelist. """ BRACKETING_EXCLUDES = 'excludes-bracketing.txt' # load the keywords files = FileUtils() files.open_datafile(BRACKETING_EXCLUDES) keywords= [] for line in files.f: keywords.append(line.rstrip('\n')) files.close() return keywords
import os, sys import numpy as np from fileutils import FileUtils from metric import ConfusionMatrix from sklearn.metrics import accuracy_score from utils.ply import read_ply, write_ply import ipdb utils = FileUtils() num_classes = 9 label_names = [ 'unclassified', 'ground', 'veg', 'cars', 'trucks', 'powerlines', 'fences/hedges', 'poles', 'buildings' ] data_dir = '/home/vlab/Nina/SemanticSegmentation/KPConv/Data/NPM3D/test_points/' def get_rgb_color_codes(preds): rgb = np.zeros((preds.shape[0], 3)) rgb[np.where(preds == 0)[0], :] = [0, 0, 100] rgb[np.where(preds == 1)[0], :] = [0, 0, 255] rgb[np.where(preds == 2)[0], :] = [0, 153, 0] rgb[np.where(preds == 3)[0], :] = [255, 0, 255] rgb[np.where(preds == 4)[0], :] = [255, 0, 255] rgb[np.where(preds == 5)[0], :] = [255, 255, 0] rgb[np.where(preds == 6)[0], :] = [255, 128, 0] rgb[np.where(preds == 7)[0], :] = [0, 255, 255]