From f3a86f698473069766e917bd11bcfdbdaa19c944 Mon Sep 17 00:00:00 2001 From: yonghakim Date: Wed, 1 May 2024 17:33:39 +0900 Subject: [PATCH] update modeling.py in TorchMeent for vector modeling. --- meent/on_torch/modeler/modeling.py | 16 +++++++++++----- setup.py | 2 +- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/meent/on_torch/modeler/modeling.py b/meent/on_torch/modeler/modeling.py index 20c0314..55cf3a0 100644 --- a/meent/on_torch/modeler/modeling.py +++ b/meent/on_torch/modeler/modeling.py @@ -39,6 +39,11 @@ def __init__(self, period=None, *args, **kwargs): self.ucell_info_list = None self.period = period + self.film_layer = None + + def film(self): + return [] + @staticmethod def rectangle_no_approximation(cx, cy, lx, ly, base): @@ -546,8 +551,6 @@ def ellipse(self, cx, cy, lx, ly, n_index, angle=0, n_split_w=2, n_split_h=2, an right_array.append(points_contour_rot[:, y_highest_index]) elif left_y < right_y: left_array.append(points_contour_rot[:, y_highest_index]) - else: - raise ValueError # TODO for i in range(points_contour_rot.shape[1]//2): left_array.append(points_contour_rot[:, (y_highest_index+i+1) % points_contour_rot.shape[1]]) @@ -690,9 +693,9 @@ def vector(self, layer_info, x64=True): col_list.insert(index, bottom_right[1]) if not row_list or row_list[-1] != self.period[1]: - row_list.append(self.period[1].reshape(1)) + row_list.append(self.period[1].reshape(1).type(datatype)) if not col_list or col_list[-1] != self.period[0]: - col_list.append(self.period[0].reshape(1)) + col_list.append(self.period[0].reshape(1).type(datatype)) if row_list and row_list[0] == 0: row_list = row_list[1:] @@ -727,10 +730,13 @@ def vector(self, layer_info, x64=True): def draw(self, layer_info_list): ucell_info_list = [] + self.film_layer = torch.zeros(len(layer_info_list)) - for layer_info in layer_info_list: + for i, layer_info in enumerate(layer_info_list): ucell_layer, x_list, y_list = self.vector(layer_info) ucell_info_list.append([ucell_layer, x_list, y_list]) + if len(x_list) == len(y_list) == 1: + self.film_layer[i] = 1 self.ucell_info_list = ucell_info_list return ucell_info_list diff --git a/setup.py b/setup.py index 732292c..719a04a 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ } setup( name='meent', - version='0.9.9', + version='0.9.10', url='https://github.com/kc-ml2/meent', author='KC ML2', author_email='yongha@kc-ml2.com',