Exemplo n.º 1
0
 def __init__(self, parent=None):
     super(MyWidget, self).__init__(parent)
     self.setupUi(self)
     self.beach_dir = ""
     self.forest_dir = ""
     self.d = weights.data("weights")
     self.ow, self.oh, self.inpf, self.inpb, self.w, self.m = self.d.load()
     if self.ow == -1:
         QtGui.QMessageBox.about(self, "ERROR", "error in weights file")
         exit(0)
     self.s = som.som(self.ow * self.oh * 3, self.inpf + self.inpb, 0.01)
     self.s.init()
     print self.ow * self.oh * 3 * (self.inpf + self.inpb), " ", len(self.m)
     self.s.put_weights(self.w, self.m)
     self.img1 = image.image(self.ow, self.oh)
     self.img2 = image.image(self.ow, self.oh)
     self.text = ""
     self.f_dir = ""
     self.b_dir = ""
     self.timer = QtCore.QTimer()
     self.timer.setInterval(1000)
     self.timer.timeout.connect(self.re_write)
     self.timer.start()
     self.start.clicked.connect(self.start_func)
     self.open_b.clicked.connect(self.open_b_dir)
     self.open_f.clicked.connect(self.open_f_dir)
     self.run = False
Exemplo n.º 2
0
    def __init__(self, parent=None):
        super(MyWidget, self).__init__(parent)
        self.setupUi(self)
        self.d = weights.data("weights")
        self.ow, self.oh, self.inpm, self.inpn, self.w, self.m = self.d.load()
        if self.ow == -1:
            QtGui.QMessageBox.about(self, "ERROR", "error in weights file")
            exit(0)

        self.s = som.som(self.ow * self.oh * 3, self.inpm + self.inpn, 0.01)
        self.s.init()
        self.s.put_weights(self.w, self.m)
        self.file = ""
        self.pushButton_2.clicked.connect(self.open)
        self.pushButton.clicked.connect(self.open_file)
        self.label.setScaledContents(True)
Exemplo n.º 3
0
    def __init__(self, parent=None):
        super(MyWidget, self).__init__(parent)
        self.setupUi(self)
        self.ow = 80
        self.oh = 60
        self.d = weights.data("weights")
        self.img = image.image(self.ow, self.oh)

        self.timer = QtCore.QTimer()
        self.timer.setInterval(1500)
        self.timer.timeout.connect(self.re_write)
        self.timer.start()
        self.start.clicked.connect(self.start_func)
        self.b_open.clicked.connect(self.open_b)
        self.f_open.clicked.connect(self.open_f)
        self.run = False
Exemplo n.º 4
0
details.

* You should have received a copy of the GNU General Public License along with
this. If not, see http://www.gnu.org/licenses/.

"""

import som4
import weights
import image


ow = 640 / 8
oh = 480 / 8

d = weights.data("weights")

img = image.image(ow, oh)

num_classes = img.get_all_images("./forest")
num_classes = img.get_all_images("./beach")

s = som4.som(ow * oh * 3, num_classes, 0.01)
s.init()

img.save_all()
print num_classes

for i in range(0, num_classes):
    dataset = img.get_data_set(i)
    indx = s.learn(dataset, str(i))