Пример #1
0
NeuralNetwork* SaveManager::LoadNetwork(QString neuralNetworkName)
{
    const QString fileXmlName = neuralNetworkName; //savePath+neuralNetworkName+".xml"; NE FONCTIONNE PAS CHEZ MOI
    QFile* xmlFile = new QFile(fileXmlName);
    if (!xmlFile->exists())
    {   std::cout << "file does not exist" << std::endl;
        return nullptr;
    }
    else if (!xmlFile->open(QIODevice::ReadOnly | QIODevice::Text))
    {   std::cout << "Can't open the file" << std::endl;
        return nullptr;
    }
    QXmlStreamReader reader(xmlFile);

    while (!reader.atEnd())
    {   QXmlStreamReader::TokenType token = reader.readNext();
        if (token==QXmlStreamReader::StartDocument)
        {   continue;
        }

        if (token==QXmlStreamReader::StartElement)
        {   if (reader.name()=="NeuralNetwork")
            {   return LoadNetwork(reader);
            }
        }
    }

    if (reader.hasError())
    {   std::cout << "Error in reading XML" << std::endl;
    }

    return nullptr;
}
Пример #2
0
	bool OnLoad(const CString& sArgsi, CString& sMessage) override {
		switch (GetType()) {
			case CModInfo::GlobalModule:
				LoadUsers();
				break;
			case CModInfo::UserModule:
				LoadUser(GetUser());
				break;
			case CModInfo::NetworkModule:
				LoadNetwork(GetNetwork());
				break;
		}
		return true;
	}
Пример #3
0
int main(int argc, char *argv[])
{
	char *s;

   Initialise(argc,argv);

	CreateHeap(&modelHeap, "Model heap",  MSTAK, 1, 0.0, 100000, 800000 );
   CreateHMMSet(&hset,&modelHeap,TRUE);

   while (NextArg() == SWITCHARG) {
      s = GetSwtArg();
      if (strlen(s)!=1)
         HError(3219,"HNetTest: Bad switch %s; must be single letter",s);
      switch(s[0]){

      case 'H':
         if (NextArg() != STRINGARG)
            HError(3219,"HNetTest: MMF File name expected");
         AddMMF(&hset,GetStrArg());
         break;
		default:
         HError(3219,"HNetTest: Unknown switch %s",s);
      }
   }

	if (NextArg()!=STRINGARG)
      HError(999,"HNetTest: Dictionary file name expected");
   dictFn = GetStrArg();
	if (NextArg()!=STRINGARG)
      HError(999,"HNetTest: Word Net file name expected");
   wdNetFn = GetStrArg();
   if (NextArg()!=STRINGARG)
      HError(999,"HNetTest: HMM list  file name expected");
   hmmListFn = GetStrArg();

	if(MakeHMMSet(&hset,hmmListFn)<SUCCESS)
      HError(999,"HNetTest: MakeHMMSet failed");
   if(LoadHMMSet(&hset,NULL,NULL)<SUCCESS)
      HError(999,"HNetTest: LoadHMMSet failed");

   InitVocab(&vocab);
   if(ReadDict(dictFn,&vocab)<SUCCESS)
      HError(3213, "HNetTest: ReadDict failed");

	LoadNetwork();

}
Пример #4
0
	void LoadUser(CUser* pUser) {
		const std::vector<CIRCNetwork*>& vNetworks = pUser->GetNetworks();
		for (const CIRCNetwork* pNetwork : vNetworks) {
			LoadNetwork(pNetwork);
		}
	}