コード例 #1
0
    def render(self, is_lock):
        bimpy.indent(10)

        bimpy.text('- Plane')
        bimpy.same_line()
        bimpy_tools.help_marker(
            'generate with random points\n' \
            '* plane random: random on whole plane\n' \
            '* balanced random: balanced positive and negative samples'
        )

        bimpy.push_item_width(140)

        if bimpy.begin_combo('strategy##plane_random_generator',
                             self._select_strategy):
            for item in self._strategy_list:
                is_selected = bimpy.Bool(self._select_strategy == item)

                if bimpy.selectable(item, is_selected) and not is_lock:
                    self._select_strategy = item

                if is_selected.value:
                    bimpy.set_item_default_focus()
            bimpy.end_combo()

        bimpy.pop_item_width()
        bimpy.unindent(10)
コード例 #2
0
    def render(self, is_lock):
        bimpy.indent(10)

        bimpy.text('- Linear layer init')
        bimpy.same_line()
        bimpy_tools.help_marker(
            'Initializer used in torch.nn.Linear, use Kaiming uniform')

        bimpy.push_item_width(120)

        flags = bimpy.InputTextFlags.EnterReturnsTrue
        if is_lock:
            flags |= bimpy.InputTextFlags.ReadOnly

        if bimpy.input_float('a##sgd_optimizer', self._a, flags=flags):
            self._a.value = max(0.0, self._a.value)

        if bimpy.begin_combo('mode##linear_layer_init', self._select_mode):
            for item in self._mode_list:
                is_selected = bimpy.Bool(self._select_mode == item)

                if bimpy.selectable(item, is_selected) and not is_lock:
                    self._select_mode = item

                if is_selected.value:
                    bimpy.set_item_default_focus()
            bimpy.end_combo()

        if bimpy.begin_combo('nonlinearity##linear_layer_init',
                             self._select_nonlinearity):
            for item in self._nonlinearity_list:
                is_selected = bimpy.Bool(self._select_nonlinearity == item)

                if bimpy.selectable(item, is_selected) and not is_lock:
                    self._select_nonlinearity = item

                if is_selected.value:
                    bimpy.set_item_default_focus()
            bimpy.end_combo()

        bimpy.pop_item_width()
        bimpy.unindent(10)
コード例 #3
0
    def render(self, is_lock):
        bimpy.set_next_tree_node_open(True, bimpy.Condition.FirstUseEver)

        if not bimpy.tree_node('optimizer##optimizer_component'):
            return

        if bimpy.begin_combo('select##optimizer_component',
                             self._select_optimizer):
            for item in self._optimizer_list:
                is_selected = bimpy.Bool(self._select_optimizer == item)

                if bimpy.selectable(item, is_selected) and not is_lock:
                    self._select_optimizer = item

                if is_selected.value:
                    bimpy.set_item_default_focus()
            bimpy.end_combo()

        self._optimizer_map[self._select_optimizer].render(is_lock)

        bimpy.tree_pop()
コード例 #4
0
ファイル: mse_loss_fn.py プロジェクト: Solitry/convex_hull
    def render(self, is_lock):
        bimpy.indent(10)

        bimpy.text('- MSE loss')
        bimpy.same_line()
        bimpy_tools.help_marker('torch.nn.MSELoss')

        bimpy.push_item_width(120)

        if bimpy.begin_combo('reduction##mse_loss_fn', self._select_redution):
            for item in self._reduction_list:
                is_selected = bimpy.Bool(self._select_redution == item)

                if bimpy.selectable(item, is_selected) and not is_lock:
                    self._select_redution = item

                if is_selected.value:
                    bimpy.set_item_default_focus()
            bimpy.end_combo()
        
        bimpy.pop_item_width()
        bimpy.unindent(10)
コード例 #5
0
    def render(self, is_lock):
        bimpy.indent(10)

        bimpy.text('- Raw Point')
        bimpy.same_line()
        bimpy_tools.help_marker('generate with raw points')

        bimpy.push_item_width(120)

        if bimpy.begin_combo('strategy##raw_point_generator',
                             self._select_strategy):
            for item in self._strategy_list:
                is_selected = bimpy.Bool(self._select_strategy == item)

                if bimpy.selectable(item, is_selected) and not is_lock:
                    self._select_strategy = item

                if is_selected.value:
                    bimpy.set_item_default_focus()
            bimpy.end_combo()

        bimpy.pop_item_width()
        bimpy.unindent(10)
コード例 #6
0
ファイル: tester.py プロジェクト: njazz/syphonpy
        val1 += 1

        bimpy.image(tex1, bimpy.Vec2(640, 480))
        bimpy.text(str(_texture))

        bimpy.text(server.context())
        pass
    except Exception as e:
        bimpy.text(str(e))

    bimpy.begin("Client")
    if bimpy.begin_combo("Source", sel_str):
        lst = syphonpy.ServerDirectory.servers()

        for k in lst:
            if bimpy.selectable(k.name + " : " + k.app_name):
                client = syphonpy.SyphonClient(k)
                sel_str = k.name + " : " + k.app_name

        bimpy.end_combo()

    _tex = 0
    if client:
        # _tex = glGenTextures(1)
        img = client.new_frame_image()
        # glBindTexture(GL_TEXTURE_2D, _tex)
        # print(img)
        pass

    if img and img.texture_size().width and img.texture_size().height:
コード例 #7
0
    def render(self, ctx, windows_info):

        pos = bimpy.Vec2(conf.margin, conf.margin)
        size_min = bimpy.Vec2(conf.min_file_browser_width,
                              ctx.height() - 2 * conf.margin)
        size_max = bimpy.Vec2(conf.max_file_browser_width,
                              ctx.height() - 2 * conf.margin)

        bimpy.set_next_window_pos(pos, bimpy.Condition.Once)
        bimpy.set_next_window_size_constraints(size_min, size_max)

        bimpy.begin(LANG.file_brewswer_ui_title, bimpy.Bool(True),
                    bimpy.WindowFlags.NoCollapse | bimpy.WindowFlags.NoMove)

        ###########UI###########
        if bimpy.button(LANG.file_brewswer_ui_refresh) == True:
            self.fb.refresh_file_list()

        bimpy.same_line()
        if bimpy.button(LANG.about) == True:
            bimpy.open_popup(LANG.about)

        # call render about ui
        # print(dir(windows_info['about_ui']))
        windows_info['about_ui']['self'].about()

        for idx, f_name in enumerate(self.fb.file_list):
            # print(self.selected.value)
            if bimpy.selectable(
                    f_name.split('\\')[-1], self.selected.value == idx):
                self.selected.value = idx

                if self.selected.value != -1 and self.selected.value != self.preidx:
                    self.preidx = self.selected.value
                    windows_info['image_shower_ui']['self'].update_pic(f_name)
                    windows_info['meta_info_ui']['self'].update_meta_info(
                        f_name)

        # progress bar
        if not self.fb.q.empty():
            self.process = self.fb.q.get()

            f, d = self.process[-2], self.process[-1]
            # update if new
            if d != {}:
                self.fb.pp.yolo_res[f] = d

            self.process = (self.process[0] + 1, self.process[1])

            if self.process[0] == self.process[1]:
                with open('yolo_res', 'wb') as f:
                    pickle.dump(self.fb.pp.yolo_res, f)

                # build retrieval index
                windows_info['retrival_ui']['self'].init = False

        sz = bimpy.get_window_size()
        bimpy.set_cursor_pos(bimpy.Vec2(conf.margin, sz.y - conf.margin * 2))
        bimpy.push_item_width(sz.x - conf.margin * 3 - 60)

        process = self.process
        bimpy.progress_bar(process[0] / float(process[1]),
                           bimpy.Vec2(0.0, 0.0),
                           "{}/{}".format(process[0], process[1]))

        bimpy.same_line()
        if bimpy.button(LANG.reindex) == True and process[0] == process[1]:
            self.fb.refresh()

        ########################

        t = {
            'x': bimpy.get_window_pos().x,
            'y': bimpy.get_window_pos().y,
            'w': bimpy.get_window_size().x,
            'h': bimpy.get_window_size().y,
            'self': self,
        }

        bimpy.end()

        return t