Exemple #1
0
import MySQLdb as mdb

#from common import parseConfig
from parseConfig import parseConfig

config = parseConfig('opsweb.conf', 'mysqld')

conn = mdb.connect(
          host = config['host'], 
          user = config['user'], 
          passwd = config['password'], 
          db = config['db'], 
          charset = config['charset']
      )

cursor = conn.cursor()

conn.autocommit(1)


def execute_sql(sql):
    return cursor.execute(sql)

def select_all_result(sql):
    cursor.execute(sql)
    return cursor.fetchall()

Created on Thu May  7 09:13:52 2020

@author: alex
"""
from __future__ import absolute_import
from matplotlib import pyplot as plt
# from keras.optimizers import SGD
from clodsa.augmentors.augmentorFactory import createAugmentor
from clodsa.transformers.transformerFactory import transformerGenerator
from clodsa.techniques.techniqueFactory import createTechnique
from clodsa.utils.minivgg import MiniVGGNet
import cv2
import parseConfig

###
config = parseConfig.parseConfig("config_augmentImages.json")
augmentor = createAugmentor(config["problem"], config["annotationMode"],
                            config["outputMode"], config["generationMode"],
                            config["inputPath"],
                            {"outputPath": config["outputPath"]})
transformer = transformerGenerator(config["problem"])
###

# Load the techniques and add them to the augmentor
techniques = [
    createTechnique(technique, param)
    for (technique, param) in config["augmentationTechniques"]
]

i = 0
	# Wait for a connection
	#print >>sys.stderr, 'waiting for a connection'
	
	try:
		connection, client_address = sock.accept()
	except:
		return None
	
	#print >>sys.stderr, 'connection from', client_address
	# make connection nonblocking
	connection.settimeout(0)
	
	return connection

# get parameters from the config file  
name, ports, useAccel, useLight, useADC, useWeather, numRelayStat, fileLengthSec, fileLengthDay, DeploymentID, DeploymentToken, networkNum, notiTime = parseConfig()

PORT = 9000

FeatureList = ("timestamp_1,timestamp_2,"
	+"x_mean,x_median,x_max,x_var,x_rms,x_IQR,x_meanXrate,x_meanDiff,x_maxDiff,x_teager_mean,x_teager_std,"
	+"x_teager_max,x_fft_0_1_max,x_fft_mean_0_1,x_fft_1_3_max,x_fft_mean_1_3,x_fft_3_10_max,x_fft_mean_3_10,"
	+"y_mean,y_median,y_max,y_var,y_rms,y_IQR,y_meanXrate,y_meanDiff,y_maxDiff,y_teager_mean,y_teager_std,"
	+"y_teager_max,y_fft_0_1_max,y_fft_mean_0_1,y_fft_1_3_max,y_fft_mean_1_3,y_fft_3_10_max,y_fft_mean_3_10,"
	+"z_mean,z_median,z_max,z_var,z_rms,z_IQR,z_meanXrate,z_meanDiff,z_maxDiff,z_teager_mean,z_teager_std,"
	+"z_teager_max,z_fft_0_1_max,z_fft_mean_0_1,z_fft_1_3_max,z_fft_mean_1_3,z_fft_3_10_max,z_fft_mean_3_10,"
	+"mag_mean,mag_median,mag_max,mag_var,mag_rms,mag_IQR,mag_meanXrate,mag_meanDiff,mag_maxDiff,mag_teager_mean,mag_teager_std,"
	+"mag_teager_max,mag_fft_0_1_max,mag_fft_mean_0_1,mag_fft_1_3_max,mag_fft_mean_1_3,mag_fft_3_10_max,mag_fft_mean_3_10,"
	+"corr_xy,corr_xz,corr_yz"
	+"\n")
Exemple #4
0
"""
Created on Thu May  7 09:13:52 2020

@author: alex
"""
from __future__ import absolute_import
from matplotlib import pyplot as plt
# from keras.optimizers import SGD
from clodsa.augmentors.augmentorFactory import createAugmentor
from clodsa.transformers.transformerFactory import transformerGenerator
from clodsa.techniques.techniqueFactory import createTechnique
from clodsa.utils.minivgg import MiniVGGNet
import cv2
import parseConfig

config = parseConfig.parseConfig("cats_dogs_folder_folder_linear.json")

augmentor = createAugmentor(config["problem"],config["annotationMode"],config["outputMode"],config["generationMode"],config["inputPath"],
                            {"outputPath":config["outputPath"]})

transformer = transformerGenerator(config["problem"])

# Load the techniques and add them to the augmentor
techniques = [createTechnique(technique,param) for (technique,param) in config["augmentationTechniques"]]

print("Number of images in input folder")
!ls /home/alex/anaconda3/envs/DD2424-project/DD2424---Project-Covid-19/git/datasets/images | wc -l

img = {}
img["original"] = cv2.imread(config["inputPath"] + "images/cat_1.jpg")