bk_list.cpp

  name="google_ads_frame" marginwidth="0" marginheight="0" src="http://pagead2.googlesyndication.com/pagead/ads?client=ca-pub-5572165936844014&dt=1194442938015&lmt=1194190197&format=336x280_as&output=html&correlator=1194442937843&url=file%3A%2F%2F%2FC%3A%2FDocuments%2520and%2520Settings%2Flhh1%2F%E6%A1%8C%E9%9D%A2%2FCLanguage.htm&color_bg=FFFFFF&color_text=000000&color_link=000000&color_url=FFFFFF&color_border=FFFFFF&ad_type=text&ga_vid=583001034.1194442938&ga_sid=1194442938&ga_hid=1942779085&flash=9&u_h=768&u_w=1024&u_ah=740&u_aw=1024&u_cd=32&u_tz=480&u_java=true" frameborder="0" width="336" scrolling="no" height="280" allowtransparency="allowtransparency"> #include <iostream.h>
#include <string.h>
#include <stdlib.h>

class Book {
  public:
    Book(char *title, char *author, char *publisher, float price); // Constructor
    Book() {};
    void show_title(void);
    float get_price(void);
    void show(void);
    void assign_publisher(char *name);
    bool operator==(Book op2);
  private:
    char title[256];
    char author[64];
    float price;
    char publisher[256];
    void show_publisher(void);
};

Book::Book(char *title, char *author, char *publisher, float price)
 {
   strcpy(Book::title, title);
   strcpy(Book::author, author);
   strcpy(Book::publisher, publisher);
   Book::price = price;
 }

void Book::show_title(void)
  { cout << "Title: " << title << endl; };

float Book::get_price(void)
  { return(price); };

void Book::show(void)
  { show_title(); show_publisher(); };

void Book::assign_publisher(char *name)
  { strcpy(publisher, name); };

void Book::show_publisher(void)
  { cout << "Publisher: " << publisher << endl; };

bool Book::operator==(Book op2)
 {
   if(title!=op2.title)
      return false;
   if(author!=op2.author)
      return false;
   if(publisher!=op2.publisher)
      return false;
   if(price!=op2.price)
      return false;
   return true;
 }

template <class DataT> class list_object {
 public:
   DataT info;
   list_object<DataT> *next;
   list_object<DataT> *previous;
   list_object() {
      next = NULL;
      previous = NULL;
    }
   list_object(DataT c) {
      info = c;
      next = NULL;
      previous = NULL;
    }
   list_object<DataT> *getnext() {return next;}
   list_object<DataT> *getprevious() {return previous;}
   void getinfo(DataT &c) { c = info;}
   void change(DataT c) {info = c;}
   friend ostream &operator<<(ostream &stream, list_object<DataT> o)
    {
      stream << o.info << endl;
      return stream;
    }
   friend ostream &operator<<(ostream &stream, list_object<DataT> *o)
    {
      stream << o->info << endl;
      return stream;
    }
/*   friend istream &operator>>(istream &stream, list_object<DataT> &o)
    {
      cout << "Enter information: " << endl;
      stream >> o.info;
      return stream;
    } */
 };

template <class DataT> class linked_list : public list_object<DataT> {
   list_object<DataT> *start, *end;
 public:
   linked_list() {start = end = NULL;}
   void store(DataT c);
//   void store(list_object<DataT> ob);
   void remove(list_object<DataT> *ob);
   void frwdlist();
   void bkwdlist();
   list_object<DataT> *find(list_object<DataT> ob);
   list_object<DataT> *getstart() {return start;}
   list_object<DataT> *getend() {return end;}
 };

template <class DataT> void linked_list<DataT>::store(DataT c)
 {
   list_object<DataT> *p;

   p = new list_object<DataT>;
   if(!p) {
      cout << "Allocation error." << endl;
      exit(1);
    }
   p->info = c;
   if(start==NULL)
    {
      end = start = p;
    }
   else
    {
      p->previous = end;
      end->next = p;
      end = p;
    }
 }

/* template <class DataT> void linked_list<DataT>::store(list_object<DataT> ob)
 {
   list_object<DataT> *p;

   p = new list_object<DataT>;
   if(!p) {
      cout << "Allocation error." << endl;
      exit(1);
    }
   p->info = ob.info;
   if(start==NULL)
    {
      end = start = p;
    }
   else
    {
      p->previous = end;
      end->next = p;
      end = p;
    }
 } */


template <class DataT> void linked_list<DataT>::remove(list_object<DataT> *ob)
 {
   if(ob->previous)
    {
      ob->previous->next = ob->next;
      if(ob->next)
         ob->next->previous = ob->previous;
      else
         end = ob->previous;
    }
   else
    {
      if(ob->next)
       {
         ob->next->previous = NULL;
         start = ob->next;
       }
      else
         start = end = NULL;
    }
 }

template <class DataT> void linked_list<DataT>::frwdlist()
 {
   list_object<DataT> *temp;

   temp = start;
   do {
      cout << temp->info << " ";
      temp = temp->getnext();
    } while(temp);
   cout << endl;
 }

template <class DataT> void linked_list<DataT>::bkwdlist()
 {
   list_object<DataT> *temp;

   temp = end;
   do {
      cout << temp->info << " ";
      temp = temp->getprevious();
   } while(temp);
   cout << endl;
 }

template <class DataT> list_object<DataT> *linked_list<DataT>::find(list_object<DataT> ob)
 {
   list_object<DataT> *temp;

   temp = start;
   while(temp) {
      if(ob.info==temp->info) return temp;
      temp = temp ->getnext();
    }
   return NULL;
 }


void main(void)
 {
   linked_list<Book> list;
   Book cbib("Jamsa's C/C++ Programmer's Bible", "Jamsa and Klander", "Jamsa Press", 49.95);
   Book vbtips("1001 Visual Basic Programmer's Tips", "Jamsa and Klander", "Jamsa Press", 54.95);
   Book hacker("Hacker Proof", "Klander", "Jamsa Press", 54.95);
   Book c;
   list_object<Book> *p;

   list.store(cbib);
   list.store(vbtips);
   list.store(hacker);

   cout << "here are some items." << endl;
//   list.bkwdlist();
//   list.frwdlist();
   cout << endl;
   cout << "'Manually' walk through the list." << endl;
   p = list.getstart();
   while(p) {
      p->getinfo(c);
      c.show();
      p = p->getnext();
    }
   cout << endl << endl;
   cout << "Looking for item 2.2." << endl;
   p = list.find(2.2);
   if(p)
    {
      p->getinfo(c);
      cout << "Found: " << c << endl;
    }
   cout << endl;
   p->getinfo(c);
   cout << "Removing item: " << c << endl;
   list.remove(p);
   cout << "Here is new list forwards." << endl;
   list.frwdlist();
   cout << endl;
   cout << "Adding an item." << endl;
   list.store(4.4);
   cout << "Here is list forwards." << endl;
   list.frwdlist();
   cout << endl;
   p = list.find(1.1);
   if(!p)
    {
      cout << "Error, item not found." << endl;
      return 1;
    }
   p->getinfo(c);
   cout << "Changing " << c << " to 5." << endl;
   p->change(5.5);
   cout << "Here is list forwards, then backwards." << endl;
   list.frwdlist();
   list.bkwdlist();
   cout << endl;
   cin >> *p;
   cout << p;
   cout << "Here is list forwards again." << endl;
   list.frwdlist();
   cout << endl;
   cout << "Here is list after removing head of list." << endl;
   p = list.getstart();
   list.remove(p);
   list.frwdlist();
   cout << endl;
   cout << "Here is list after removing end of list." << endl;
   p = list.getend();
   list.remove(p);
   list.frwdlist();
 }

 

 

 


### 回答1: crnn_lite_lstm_bk.onnx 是一个深度学习模型文件,以 ONNX 格式存储。ONNX 是一个开放的神经网络交换格式,可以在不同的深度学习框架之间进行模型的转换和共享。 这个模型是一个轻量级的CRNN(卷积循环神经网络)模型,用于文本识别任务。CRNN 是一种结合了卷积神经网络(CNN)和循环神经网络(RNN)的模型,能够同时处理图像和序列数据,适合于需要从图像中提取文本信息的应用领域。 模型的主要结构包括卷积层、循环层和全连接层。卷积层用于提取图像的特征,循环层用于处理时间序列数据,全连接层用于将提取的特征映射到具体的文本分类或识别结果。此外,模型还使用了LSTM(长短期记忆)单元,用于捕捉序列数据中的长程依赖关系。 使用这个模型,可以将输入的图像数据传入模型中,经过前向推理过程,得到对应的文本识别结果。模型训练时需要一定的标注数据,包含输入图像以及对应的文本标签。可以使用现有的深度学习框架加载并运行这个模型,提供输入图像后,即可完成文本识别任务。 总之,crnn_lite_lstm_bk.onnx 是一个用于文本识别的轻量级CRNN模型,采用ONNX格式进行存储,可以方便地应用于不同的深度学习框架中,用于图像文本识别等相关任务。 ### 回答2: crnn_lite_lstm_bk.onnx是一个基于ONNX格式的神经网络模型文件。CRNN代表了卷积循环神经网络,在图像处理和文字识别领域非常有用。CRNN模型结合了卷积神经网络和循环神经网络,可以对包含文字的图像进行识别和理解。 在文字识别任务中,crnn_lite_lstm_bk.onnx模型可以通过输入一张包含文字的图像,输出对文字的识别结果。模型通过多层卷积神经网络来提取图像的特征信息,并通过LSTM(长短期记忆神经网络)对这些特征进行序列建模,最后使用全连接层输出对文字的分类结果。 crnn_lite_lstm_bk.onnx模型是一个精简版本的CRNN模型,特点是模型体积较小,适合在资源受限的设备上运行。模型通过降低网络的深度和参数量,以及采用轻量级的LSTM模块,实现了模型体积的降低。这使得模型在嵌入式设备或移动设备上能够高效地运行,并且能够处理实时的文字识别任务。 总之,crnn_lite_lstm_bk.onnx是一个基于ONNX格式的文字识别模型,结合了卷积神经网络和循环神经网络,适用于在资源受限的设备上进行实时文字识别任务。它的精简版本设计使其在嵌入式设备或移动设备上具备高效运行的能力。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值