Synapse::Synapse() { potentiation=randomFloat(-0.25, 0.25); fire_frequency=numberBetween(0,5); fire_timer=0; weight = initWeight(); }
void Net::addSynapse(Neuron * from, Neuron * to) { Synapse newSynapse(from, to, synapseIndex--); if(from && to){ newSynapse.weight = initWeight(); } synapse.push_back(newSynapse); }
//Constructor Synapse::Synapse(Neuron * whoFrom, Neuron * whoTo, int i) { from = whoFrom; to = whoTo; index = i; potentiation=randomFloat(-0.25, 0.25); fire_frequency=numberBetween(1,5); fire_timer=0; weight = initWeight(); }
void Player::initPlayer(ClipEntry& clipEntry) { this->clipEntry = &clipEntry; clipMaskFileNames = ReadLines(Config.GetForegroundFolder(clipEntry)); frameNumber = clipEntry.GetFrameCount(); cout << "frameNumber: " << frameNumber << endl; startFrameNumber = 0; nowFrameNumber = 0; waitKeyNumber = 32; nowSequenceNumber = 0; weightPath = Config.GetWeightsPath(clipEntry); weightW = 1000; weightH = 200; sequencePath = Config.GetSequencePath(clipEntry); initWeight(); initSequence(); namedWindow("Display", CV_WINDOW_AUTOSIZE); namedWindow("Foreground", CV_WINDOW_AUTOSIZE); namedWindow("Weight", CV_WINDOW_AUTOSIZE); createTrackbar("Frame", "Weight", 0, frameNumber-1, changeBar, (void*)this); setTrackbarPos("Frame", "Weight", nowFrameNumber); createTrackbar("Speed", "Weight", 0, 6, changeSpeed, (void*)this); setTrackbarPos("Speed", "Weight", 3); if(clipEntry.Type == ClipType::Video){ Mat frame; int num = 11; while(num--) clipEntry.Video.read(frame); } showFrame(s[0],1); loop(); }
bool MKLDNNBatchNormLayer::init(const LayerMap& layerMap, const ParameterMap& parameterMap) { if (!MKLDNNLayer::init(layerMap, parameterMap)) { return false; } // first one is input layer // the other two are created in config_parser.py saving moving mean and var CHECK_EQ(inputLayers_.size(), 3U); CHECK_EQ(inputLayers_.size(), parameters_.size()); CHECK_EQ(inputLayers_.size(), size_t(config_.inputs_size())); const ImageConfig& conf = config_.inputs(0).image_conf(); ic_ = conf.channels(); ih_ = inputLayers_[0]->getOutput().getFrameHeight(); iw_ = inputLayers_[0]->getOutput().getFrameWidth(); if (iw_ == 0 && ih_ == 0) { iw_ = conf.img_size(); ih_ = conf.has_img_size_y() ? conf.img_size_y() : conf.img_size(); } oc_ = ic_; oh_ = ih_; ow_ = iw_; if (config_.has_use_global_stats()) { useGlobalStats_ = config_.use_global_stats(); } movingAvgFraction_ = config_.moving_average_fraction(); epsilon_ = config_.epsilon(); VLOG(MKLDNN_BASE) << "--- " << (useGlobalStats_ ? "use" : "do not use") << " --- global stats"; VLOG(MKLDNN_BASE) << "Moving average fraction: " << movingAvgFraction_; initWeight(); movingMean_.reset(new Weight(oc_, 1, parameters_[1], 0)); movingVar_.reset(new Weight(oc_, 1, parameters_[2], 0)); return true; }