| 55 | |
| 56 | |
| 57 | class EvaluateNetwork(DefaultTab): |
| 58 | def __init__(self, root, parent, h1_description): |
| 59 | super().__init__(root, parent, h1_description) |
| 60 | |
| 61 | self.bodyparts_to_use = self.root.all_bodyparts |
| 62 | |
| 63 | self._set_page() |
| 64 | |
| 65 | def _set_page(self): |
| 66 | self.main_layout.addWidget(_create_label_widget("Attributes", "font:bold")) |
| 67 | self.layout_attributes = _create_horizontal_layout() |
| 68 | self._generate_layout_attributes(self.layout_attributes) |
| 69 | self.main_layout.addLayout(self.layout_attributes) |
| 70 | |
| 71 | self.main_layout.addWidget(_create_label_widget("")) # dummy text |
| 72 | self.layout_additional_attributes = _create_vertical_layout() |
| 73 | self._generate_additional_attributes(self.layout_additional_attributes) |
| 74 | self.main_layout.addLayout(self.layout_additional_attributes) |
| 75 | |
| 76 | self.ev_nw_button = QtWidgets.QPushButton("Evaluate Network") |
| 77 | self.ev_nw_button.setMinimumWidth(150) |
| 78 | self.ev_nw_button.clicked.connect(self.evaluate_network) |
| 79 | |
| 80 | self.opt_button = QtWidgets.QPushButton("Plot 3 test maps") |
| 81 | self.opt_button.setMinimumWidth(150) |
| 82 | self.opt_button.clicked.connect(self.plot_maps) |
| 83 | |
| 84 | self.edit_inferencecfg_btn = QtWidgets.QPushButton("Edit inference_cfg.yaml") |
| 85 | self.edit_inferencecfg_btn.setMinimumWidth(150) |
| 86 | self.edit_inferencecfg_btn.clicked.connect(self.open_inferencecfg_editor) |
| 87 | |
| 88 | if self.root.is_multianimal: |
| 89 | self.main_layout.addWidget(self.edit_inferencecfg_btn, alignment=Qt.AlignRight) |
| 90 | |
| 91 | self.main_layout.addWidget(self.ev_nw_button, alignment=Qt.AlignRight) |
| 92 | self.main_layout.addWidget(self.opt_button, alignment=Qt.AlignRight) |
| 93 | |
| 94 | self.help_button = QtWidgets.QPushButton("Help") |
| 95 | self.help_button.clicked.connect(self.show_help_dialog) |
| 96 | self.main_layout.addWidget(self.help_button, alignment=Qt.AlignLeft) |
| 97 | |
| 98 | self.root.engine_change.connect(self._on_engine_change) |
| 99 | self._on_engine_change(self.root.engine) |
| 100 | |
| 101 | def show_help_dialog(self): |
| 102 | dialog = QtWidgets.QDialog(self) |
| 103 | layout = QtWidgets.QVBoxLayout() |
| 104 | label = QtWidgets.QLabel(deeplabcut.evaluate_network.__doc__, self) |
| 105 | scroll = QtWidgets.QScrollArea() |
| 106 | scroll.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn) |
| 107 | scroll.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) |
| 108 | scroll.setWidgetResizable(True) |
| 109 | scroll.setWidget(label) |
| 110 | layout.addWidget(scroll) |
| 111 | dialog.setLayout(layout) |
| 112 | dialog.exec_() |
| 113 | |
| 114 | def _generate_layout_attributes(self, layout): |