Exemple #1
0
    def SIFTgrain(self, octave):
        path_analyse = '/CT_analysesClassification/' + octave
        octaves = 6

        initial_sigma = 1.1
        gauss = GaussianSmoothing3D(self.path + path_analyse, octaves).smoothing(initial_sigma)
        dimension = 3

        dog = DoG(self.path + path_analyse, dimension)
        dog.apply()
        pathDoG = '/3DDoG/'
        local_extrema = LocalExterma3D(self.path + path_analyse + pathDoG, self.path + path_analyse, True)
        local_extrema.find()
        path_local_extrema = '/3DLocalExtremum/'
        extrema = ExtremaSpace3D(self.path + path_analyse + pathDoG + path_local_extrema)
        extrema.find()
        Hessian = HessianMatrix(5.0)
        Hessian.HessianElimination(self.path + path_analyse)

        keypointorientation = KeyPointOrientation(self.path + path_analyse)
        keypointorientation.apply()
        path_keypoint_orientation = '/KeyPointsOrientation/'
        images = ReadImage(self.path + path_analyse + path_keypoint_orientation).openImage()
        for im in images:
            rotateImage(im, 10, self.path + path_analyse).apply()

        path_discriptor = '/Descriptor3D/'
        keydis = KeypointsFeatures(self.path + path_analyse + path_discriptor, self.path + path_analyse).apply()
Exemple #2
0
    def SIFTgrain(self, octave):
        path_analyse = '/CT_analysesClassification/' + octave
        octaves = 6

        initial_sigma = 1.1
        gauss = GaussianSmoothing3D(self.path + path_analyse,
                                    octaves).smoothing(initial_sigma)
        dimension = 3

        dog = DoG(self.path + path_analyse, dimension)
        dog.apply()
        pathDoG = '/3DDoG/'
        local_extrema = LocalExterma3D(self.path + path_analyse + pathDoG,
                                       self.path + path_analyse, True)
        local_extrema.find()
        path_local_extrema = '/3DLocalExtremum/'
        extrema = ExtremaSpace3D(self.path + path_analyse + pathDoG +
                                 path_local_extrema)
        extrema.find()
        Hessian = HessianMatrix(5.0)
        Hessian.HessianElimination(self.path + path_analyse)

        keypointorientation = KeyPointOrientation(self.path + path_analyse)
        keypointorientation.apply()
        path_keypoint_orientation = '/KeyPointsOrientation/'
        images = ReadImage(self.path + path_analyse +
                           path_keypoint_orientation).openImage()
        for im in images:
            rotateImage(im, 10, self.path + path_analyse).apply()

        path_discriptor = '/Descriptor3D/'
        keydis = KeypointsFeatures(self.path + path_analyse + path_discriptor,
                                   self.path + path_analyse).apply()
Exemple #3
0
class DoG2DTest(unittest.TestCase):
    def setUp(self):
        self.path = './test_data/1_nd/CT_analyses/'
        self.dog = DoG(self.path, 2)

    def test_smoothing(self):
        self.dog.apply()

    def test_min(self):
        path = './test_data/1_nd/CT_analyses/2DDoG/'
        self.ReadImage = ReadImage(path)
        list_of_image = self.ReadImage.openImage()
        for z in list_of_image:
            print min(z.Image3D),max(z.Image3D),z.sigma

    def test_show(self):
        path = './test_data/1_nd/CT_analyses/2DDoG/'
        self.ReadImage = ReadImage(path)
        list_of_image = self.ReadImage.openImage()
        for Z in list_of_image:
            visualization2D(Z.Image3D)
Exemple #4
0
class DoG2DTest(unittest.TestCase):
    def setUp(self):
        self.path = './test_data/1_nd/CT_analyses/'
        self.dog = DoG(self.path, 2)

    def test_smoothing(self):
        self.dog.apply()

    def test_min(self):
        path = './test_data/1_nd/CT_analyses/2DDoG/'
        self.ReadImage = ReadImage(path)
        list_of_image = self.ReadImage.openImage()
        for z in list_of_image:
            print min(z.Image3D), max(z.Image3D), z.sigma

    def test_show(self):
        path = './test_data/1_nd/CT_analyses/2DDoG/'
        self.ReadImage = ReadImage(path)
        list_of_image = self.ReadImage.openImage()
        for Z in list_of_image:
            visualization2D(Z.Image3D)
Exemple #5
0
 def setUp(self):
     self.path = './test_data/1_nd/CT_analyses/'
     self.dog = DoG(self.path, 3)
Exemple #6
0
from DoG import DoG

import time
## Defining the communicating port
T_SIM=30;

DoG1=DoG(T_SIM='30',
        input_ip=['localhost'],
        input_port=['6666'],
        output_port=['6665'],
        mode_comm='RepReq')

start=time.time()
i=0
task_delay=list()
while time.time()-start<T_SIM:
    #DoG1.REQ_array_image()
    DoG1.REQ_array()

    #a=round(DoG1.REQ_latency(),2)
    #if i>4:
    #    average=round(sum(DoG1._delay_req[4:])/len(DoG1._delay_req[4:]),2)
    #    maxi=round(max(DoG1._delay_req[4:]),2)
    #    print("--- REQ instant --- : {0} ms  --- REQ max --- : {1} ms , --- REQ avg --- {2} ms".format(a,maxi,average))

    start=time.time()
    DoG1.DoG1_save()
    task_delay.append(round((time.time()-start)*1000,2))
    DoG1.display_task_delay(task_delay)

    DoG1.REP_array(DoG1.output_data)
layers.append(init_layers(total_time=total_time, C=20, H=54, W=54))
layer_4 = pool2().to('cuda')
layers.append(init_layers(total_time=total_time, C=20, H=10, W=10))
layer_5 = conv3().to('cuda')
layers.append(init_layers(total_time=total_time, C=20, H=6, W=6))
network = [layer_1, layer_2, layer_3, layer_4, layer_5]
network_len = len(network)
layer_filt_dimension = get_dim(network[0::2])

thresh = torch.Tensor([.5, .5, .5])
image_names = os.listdir(train_data)
data_len = len(image_names)
thds_per_dim = 10

for j in trange(data_len):
    image = DoG(image_name=image_names[j])
    image = np.reshape(image, (160000, ))
    image = freq(15, image, 0.05)
    image = torch.from_numpy(image).to('cuda')
    image = image.float()

    for i in range(stdp_params['max_iter']):
        for t in range(total_time):
            for l in range(network_len):
                V = layers[l]['V'][t - 1, :, :, :]
                S = layers[l]['S'][t, :, :, :]
                K_inh = layers[l]['K_inh']
                if network[l].__class__.__name__ == "conv1":
                    img = image[t, :, :, :].unsqueeze(0)
                    V = network[l](img)
                    V = V.permute(0, 3, 2, 1)
Exemple #8
0
 def setUp(self):
     self.path = './test_data/1_nd/CT_analyses/'
     self.dog = DoG(self.path, 3)