sierkinhane 5 жил өмнө
parent
commit
85d127d6b0
23 өөрчлөгдсөн 220 нэмэгдсэн , 53 устгасан
  1. 154 46
      .idea/workspace.xml
  2. 8 1
      README.md
  3. 3 1
      lib/config/360CC_config.yaml
  4. BIN
      lib/core/__pycache__/function.cpython-35.pyc
  5. 14 2
      lib/dataset/_360cc.py
  6. BIN
      lib/dataset/__pycache__/_360cc.cpython-35.pyc
  7. BIN
      lib/utils/__pycache__/utils.cpython-35.pyc
  8. 34 0
      lib/utils/preprocessing.py
  9. 5 1
      lib/utils/utils.py
  10. BIN
      output/360CC/crnn/2020-03-22-05-07/log/events.out.tfevents.1584824864.DESKTOP-LVNAKHJ
  11. BIN
      output/360CC/crnn/2020-03-22-05-08/log/events.out.tfevents.1584824890.DESKTOP-LVNAKHJ
  12. BIN
      output/360CC/crnn/2020-03-22-05-10/log/events.out.tfevents.1584825013.DESKTOP-LVNAKHJ
  13. BIN
      output/360CC/crnn/2020-03-22-05-10/log/events.out.tfevents.1584825054.DESKTOP-LVNAKHJ
  14. BIN
      output/360CC/crnn/2020-03-22-05-11/log/events.out.tfevents.1584825089.DESKTOP-LVNAKHJ
  15. BIN
      output/360CC/crnn/2020-03-22-05-12/log/events.out.tfevents.1584825129.DESKTOP-LVNAKHJ
  16. BIN
      output/360CC/crnn/2020-03-22-05-13/log/events.out.tfevents.1584825233.DESKTOP-LVNAKHJ
  17. BIN
      output/360CC/crnn/2020-03-22-05-14/log/events.out.tfevents.1584825246.DESKTOP-LVNAKHJ
  18. BIN
      output/360CC/crnn/2020-03-22-05-14/log/events.out.tfevents.1584825262.DESKTOP-LVNAKHJ
  19. BIN
      output/360CC/crnn/2020-03-22-05-15/log/events.out.tfevents.1584825302.DESKTOP-LVNAKHJ
  20. BIN
      output/360CC/crnn/2020-03-22-05-17/log/events.out.tfevents.1584825463.DESKTOP-LVNAKHJ
  21. BIN
      output/360CC/crnn/2020-03-22-05-19/checkpoints/checkpoint_0_acc_0.0000.pth
  22. BIN
      output/360CC/crnn/2020-03-22-05-19/log/events.out.tfevents.1584825548.DESKTOP-LVNAKHJ
  23. 2 2
      train.py

+ 154 - 46
.idea/workspace.xml

@@ -2,8 +2,13 @@
 <project version="4">
   <component name="ChangeListManager">
     <list default="true" id="5a6b7592-d33a-448a-b58e-33d059444ec7" name="Default Changelist" comment="">
+      <change afterPath="$PROJECT_DIR$/lib/utils/preprocessing.py" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/README.md" beforeDir="false" afterPath="$PROJECT_DIR$/README.md" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/lib/config/360CC_config.yaml" beforeDir="false" afterPath="$PROJECT_DIR$/lib/config/360CC_config.yaml" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/lib/dataset/_360cc.py" beforeDir="false" afterPath="$PROJECT_DIR$/lib/dataset/_360cc.py" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/lib/utils/utils.py" beforeDir="false" afterPath="$PROJECT_DIR$/lib/utils/utils.py" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/train.py" beforeDir="false" afterPath="$PROJECT_DIR$/train.py" afterDir="false" />
     </list>
     <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
     <option name="SHOW_DIALOG" value="false" />
@@ -15,27 +20,31 @@
     <session id="821246655">
       <usages-collector id="statistics.file.extensions.edit">
         <counts>
-          <entry key="md" value="163" />
-          <entry key="py" value="4" />
-          <entry key="yaml" value="26" />
+          <entry key="md" value="291" />
+          <entry key="py" value="486" />
+          <entry key="yaml" value="84" />
         </counts>
       </usages-collector>
       <usages-collector id="statistics.file.types.edit">
         <counts>
-          <entry key="Markdown" value="163" />
-          <entry key="Python" value="4" />
-          <entry key="YAML" value="26" />
+          <entry key="Markdown" value="291" />
+          <entry key="Python" value="486" />
+          <entry key="YAML" value="84" />
         </counts>
       </usages-collector>
       <usages-collector id="statistics.file.extensions.open">
         <counts>
           <entry key="md" value="1" />
+          <entry key="py" value="4" />
+          <entry key="txt" value="1" />
           <entry key="yaml" value="1" />
         </counts>
       </usages-collector>
       <usages-collector id="statistics.file.types.open">
         <counts>
           <entry key="Markdown" value="1" />
+          <entry key="PLAIN_TEXT" value="1" />
+          <entry key="Python" value="4" />
           <entry key="YAML" value="1" />
         </counts>
       </usages-collector>
@@ -43,7 +52,8 @@
         <counts>
           <entry key="project.closed" value="2" />
           <entry key="project.open.time.0" value="2" />
-          <entry key="project.opened" value="2" />
+          <entry key="project.open.time.2" value="1" />
+          <entry key="project.opened" value="3" />
         </counts>
       </usages-collector>
     </session>
@@ -53,8 +63,8 @@
       <file pinned="false" current-in-tab="false">
         <entry file="file://$PROJECT_DIR$/train.py">
           <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="226">
-              <caret line="91" column="24" selection-start-line="91" selection-start-column="24" selection-end-line="91" selection-end-column="24" />
+            <state relative-caret-position="322">
+              <caret line="113" column="27" selection-start-line="113" selection-start-column="27" selection-end-line="113" selection-end-column="27" />
               <folding>
                 <element signature="e#0#15#0" expanded="true" />
               </folding>
@@ -62,12 +72,21 @@
           </provider>
         </entry>
       </file>
+      <file pinned="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/lib/core/function.py">
+          <provider selected="true" editor-type-id="text-editor">
+            <state relative-caret-position="358">
+              <caret line="110" selection-start-line="110" selection-end-line="110" />
+            </state>
+          </provider>
+        </entry>
+      </file>
       <file pinned="false" current-in-tab="false">
         <entry file="file://$PROJECT_DIR$/README.md">
           <provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
             <state split_layout="SPLIT">
-              <first_editor relative-caret-position="374">
-                <caret line="26" column="12" lean-forward="true" selection-start-line="26" selection-start-column="12" selection-end-line="26" selection-end-column="12" />
+              <first_editor relative-caret-position="880">
+                <caret line="40" column="8" lean-forward="true" selection-start-line="40" selection-start-column="8" selection-end-line="40" selection-end-column="8" />
               </first_editor>
               <second_editor />
             </state>
@@ -75,10 +94,44 @@
         </entry>
       </file>
       <file pinned="false" current-in-tab="true">
+        <entry file="file://$PROJECT_DIR$/lib/dataset/_360cc.py">
+          <provider selected="true" editor-type-id="text-editor">
+            <state relative-caret-position="330">
+              <caret line="36" column="54" selection-start-line="36" selection-start-column="54" selection-end-line="36" selection-end-column="54" />
+              <folding>
+                <element signature="e#0#54#0" expanded="true" />
+              </folding>
+            </state>
+          </provider>
+        </entry>
+      </file>
+      <file pinned="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/lib/utils/preprocessing.py">
+          <provider selected="true" editor-type-id="text-editor">
+            <state relative-caret-position="286">
+              <caret line="13" column="15" selection-start-line="13" selection-start-column="15" selection-end-line="13" selection-end-column="15" />
+            </state>
+          </provider>
+        </entry>
+      </file>
+      <file pinned="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/lib/utils/utils.py">
+          <provider selected="true" editor-type-id="text-editor">
+            <state relative-caret-position="192">
+              <caret line="59" column="4" selection-start-line="59" selection-start-column="4" selection-end-line="59" selection-end-column="4" />
+              <folding>
+                <element signature="e#0#27#0" expanded="true" />
+                <marker date="1584824065564" expanded="true" signature="4927:4928" ph="..." />
+              </folding>
+            </state>
+          </provider>
+        </entry>
+      </file>
+      <file pinned="false" current-in-tab="false">
         <entry file="file://$PROJECT_DIR$/lib/config/360CC_config.yaml">
           <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="638">
-              <caret line="29" column="12" lean-forward="true" selection-start-line="29" selection-start-column="12" selection-end-line="29" selection-end-column="12" />
+            <state relative-caret-position="506">
+              <caret line="23" selection-start-line="23" selection-end-line="23" />
             </state>
           </provider>
         </entry>
@@ -86,7 +139,7 @@
       <file pinned="false" current-in-tab="false">
         <entry file="file://$PROJECT_DIR$/demo.py">
           <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="242">
+            <state relative-caret-position="22">
               <caret line="11" column="1" selection-start-line="11" selection-start-column="1" selection-end-line="11" selection-end-column="1" />
               <folding>
                 <element signature="e#0#18#0" expanded="true" />
@@ -104,9 +157,13 @@
     <option name="CHANGED_PATHS">
       <list>
         <option value="$PROJECT_DIR$/demo.py" />
+        <option value="$PROJECT_DIR$/lib/utils/utils.py" />
+        <option value="$PROJECT_DIR$/lib/config/360CC_config.yaml" />
+        <option value="$PROJECT_DIR$/lib/utils/preprocessing.py" />
+        <option value="$PROJECT_DIR$/lib/dataset/_360cc.py" />
         <option value="$PROJECT_DIR$/train.py" />
+        <option value="$PROJECT_DIR$/lib/core/function.py" />
         <option value="$PROJECT_DIR$/README.md" />
-        <option value="$PROJECT_DIR$/lib/config/360CC_config.yaml" />
       </list>
     </option>
   </component>
@@ -127,17 +184,6 @@
       <foldersAlwaysOnTop value="true" />
     </navigator>
     <panes>
-      <pane id="ProjectPane">
-        <subPane>
-          <expand>
-            <path>
-              <item name="crnn" type="b2602c69:ProjectViewProjectNode" />
-              <item name="crnn" type="462c0819:PsiDirectoryNode" />
-            </path>
-          </expand>
-          <select />
-        </subPane>
-      </pane>
       <pane id="Scope">
         <subPane subId="Scope 'Project Files'; set:Project Files; class com.intellij.psi.search.scope.ProjectFilesScope">
           <expand>
@@ -148,24 +194,43 @@
             <path>
               <item name="crnn" type="3d21c010:ScopeViewTreeModel$ProjectNode" />
               <item name="" type="442cc68d:ScopeViewTreeModel$RootNode" />
-              <item name="images" type="9f88c78c:ScopeViewTreeModel$FileNode" />
+              <item name="lib" type="9f88c78c:ScopeViewTreeModel$FileNode" />
             </path>
             <path>
               <item name="crnn" type="3d21c010:ScopeViewTreeModel$ProjectNode" />
               <item name="" type="442cc68d:ScopeViewTreeModel$RootNode" />
               <item name="lib" type="9f88c78c:ScopeViewTreeModel$FileNode" />
+              <item name="config" type="9f88c78c:ScopeViewTreeModel$FileNode" />
             </path>
             <path>
               <item name="crnn" type="3d21c010:ScopeViewTreeModel$ProjectNode" />
               <item name="" type="442cc68d:ScopeViewTreeModel$RootNode" />
               <item name="lib" type="9f88c78c:ScopeViewTreeModel$FileNode" />
-              <item name="config" type="9f88c78c:ScopeViewTreeModel$FileNode" />
+              <item name="dataset" type="9f88c78c:ScopeViewTreeModel$FileNode" />
             </path>
             <path>
               <item name="crnn" type="3d21c010:ScopeViewTreeModel$ProjectNode" />
               <item name="" type="442cc68d:ScopeViewTreeModel$RootNode" />
               <item name="lib" type="9f88c78c:ScopeViewTreeModel$FileNode" />
               <item name="dataset" type="9f88c78c:ScopeViewTreeModel$FileNode" />
+              <item name="txt" type="9f88c78c:ScopeViewTreeModel$FileNode" />
+            </path>
+            <path>
+              <item name="crnn" type="3d21c010:ScopeViewTreeModel$ProjectNode" />
+              <item name="" type="442cc68d:ScopeViewTreeModel$RootNode" />
+              <item name="lib" type="9f88c78c:ScopeViewTreeModel$FileNode" />
+              <item name="utils" type="9f88c78c:ScopeViewTreeModel$FileNode" />
+            </path>
+          </expand>
+          <select />
+        </subPane>
+      </pane>
+      <pane id="ProjectPane">
+        <subPane>
+          <expand>
+            <path>
+              <item name="crnn" type="b2602c69:ProjectViewProjectNode" />
+              <item name="crnn" type="462c0819:PsiDirectoryNode" />
             </path>
           </expand>
           <select />
@@ -177,6 +242,11 @@
     <property name="WebServerToolWindowFactoryState" value="false" />
     <property name="last_opened_file_path" value="$PROJECT_DIR$" />
   </component>
+  <component name="RecentsManager">
+    <key name="CopyFile.RECENT_KEYS">
+      <recent name="I:\Github\Sierkinhane\crnn-2020-3-21\crnn\lib\utils" />
+    </key>
+  </component>
   <component name="RunDashboard">
     <option name="ruleStates">
       <list>
@@ -206,7 +276,7 @@
     <frame x="-8" y="-8" width="1936" height="1096" extended-state="6" />
     <editor active="true" />
     <layout>
-      <window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.1881663" />
+      <window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.21748401" />
       <window_info id="Structure" order="1" side_tool="true" weight="0.25" />
       <window_info id="Favorites" order="2" side_tool="true" />
       <window_info anchor="bottom" id="Message" order="0" />
@@ -220,7 +290,7 @@
       <window_info anchor="bottom" id="Version Control" order="8" show_stripe_button="false" />
       <window_info anchor="bottom" id="Database Changes" order="9" show_stripe_button="false" />
       <window_info anchor="bottom" id="Event Log" order="10" side_tool="true" />
-      <window_info anchor="bottom" id="Terminal" order="11" weight="0.32977587" />
+      <window_info anchor="bottom" id="Terminal" order="11" visible="true" weight="0.32977587" />
       <window_info anchor="bottom" id="Python Console" order="12" />
       <window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
       <window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
@@ -259,40 +329,78 @@
     <option name="myLimit" value="2678400000" />
   </component>
   <component name="editorHistoryManager">
-    <entry file="file://$PROJECT_DIR$/README.md">
-      <provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
-        <state split_layout="SPLIT">
-          <first_editor relative-caret-position="374">
-            <caret line="26" column="12" lean-forward="true" selection-start-line="26" selection-start-column="12" selection-end-line="26" selection-end-column="12" />
-          </first_editor>
-          <second_editor />
+    <entry file="file://$PROJECT_DIR$/demo.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="22">
+          <caret line="11" column="1" selection-start-line="11" selection-start-column="1" selection-end-line="11" selection-end-column="1" />
+          <folding>
+            <element signature="e#0#18#0" expanded="true" />
+          </folding>
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/lib/dataset/txt/test.txt">
+      <provider selected="true" editor-type-id="LargeFileEditor" />
+    </entry>
+    <entry file="file://$PROJECT_DIR$/lib/config/360CC_config.yaml">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="506">
+          <caret line="23" selection-start-line="23" selection-end-line="23" />
         </state>
       </provider>
     </entry>
     <entry file="file://$PROJECT_DIR$/train.py">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="226">
-          <caret line="91" column="24" selection-start-line="91" selection-start-column="24" selection-end-line="91" selection-end-column="24" />
+        <state relative-caret-position="322">
+          <caret line="113" column="27" selection-start-line="113" selection-start-column="27" selection-end-line="113" selection-end-column="27" />
           <folding>
             <element signature="e#0#15#0" expanded="true" />
           </folding>
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/demo.py">
+    <entry file="file://$PROJECT_DIR$/lib/utils/utils.py">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="242">
-          <caret line="11" column="1" selection-start-line="11" selection-start-column="1" selection-end-line="11" selection-end-column="1" />
+        <state relative-caret-position="192">
+          <caret line="59" column="4" selection-start-line="59" selection-start-column="4" selection-end-line="59" selection-end-column="4" />
           <folding>
-            <element signature="e#0#18#0" expanded="true" />
+            <element signature="e#0#27#0" expanded="true" />
+            <marker date="1584824065564" expanded="true" signature="4927:4928" ph="..." />
           </folding>
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/lib/config/360CC_config.yaml">
+    <entry file="file://$PROJECT_DIR$/lib/core/function.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="358">
+          <caret line="110" selection-start-line="110" selection-end-line="110" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/lib/utils/preprocessing.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="286">
+          <caret line="13" column="15" selection-start-line="13" selection-start-column="15" selection-end-line="13" selection-end-column="15" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/README.md">
+      <provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
+        <state split_layout="SPLIT">
+          <first_editor relative-caret-position="880">
+            <caret line="40" column="8" lean-forward="true" selection-start-line="40" selection-start-column="8" selection-end-line="40" selection-end-column="8" />
+          </first_editor>
+          <second_editor />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/lib/dataset/_360cc.py">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="638">
-          <caret line="29" column="12" lean-forward="true" selection-start-line="29" selection-start-column="12" selection-end-line="29" selection-end-column="12" />
+        <state relative-caret-position="330">
+          <caret line="36" column="54" selection-start-line="36" selection-start-column="54" selection-end-line="36" selection-end-column="54" />
+          <folding>
+            <element signature="e#0#54#0" expanded="true" />
+          </folding>
         </state>
       </provider>
     </entry>

+ 8 - 1
README.md

@@ -28,9 +28,16 @@ A Chinese characters recognition repository based on convolutional recurrent net
       ROOT: 'to/your/images/path'
 ```
 3. Put *char_std_5990.txt* in **lib/dataset/txt/**
-4. Download the preprocessed labels in [here](https://pan.baidu.com/s/1rd4tm0sCq5fFgB2ziUxcrA) (password: w877)
+4. Download the labels in [here](https://pan.baidu.com/s/1rd4tm0sCq5fFgB2ziUxcrA) (password: w877)
 5. And put *train.txt* and *test.txt* in **lib/dataset/txt/**
 
+    test.txt
+```
+    20456343_4045240981.jpg 89 201 241 178 19 94 19 22 26 656
+    20457281_3395886438.jpg 120 1061 2 376 78 249 272 272 120 1061
+    ...
+```
+
 ## Train
 ```angular2html
    [run] python train.py --cfg lib/config/360CC_config.yaml

+ 3 - 1
lib/config/360CC_config.yaml

@@ -13,7 +13,9 @@ CUDNN:
 DATASET:
   DATASET: 360CC
   ROOT: "H:/DL-DATASET/360M/images"
-  JSON_FILE: {'train': 'lib/dataset/txt/train.txt', 'val': 'lib/dataset/txt/test.txt'}
+  CHAR_FILE: 'lib/dataset/txt/char_std_5990.txt'
+#  JSON_FILE: {'train': 'lib/dataset/txt/train.txt', 'val': 'lib/dataset/txt/test.txt'}
+  JSON_FILE: {'train': 'H:/DL-DATASET/360M/train.txt', 'val': 'H:/DL-DATASET/360M/test.txt'}
   SCALE_FACTOR: 0.25
   ROT_FACTOR: 30
   STD: 0.193

BIN
lib/core/__pycache__/function.cpython-35.pyc


+ 14 - 2
lib/dataset/_360cc.py

@@ -3,6 +3,7 @@ import torch.utils.data as data
 import os
 import numpy as np
 import cv2
+import lib.utils.utils as utils
 
 class _360CC(data.Dataset):
     def __init__(self, config, is_train=True):
@@ -17,10 +18,21 @@ class _360CC(data.Dataset):
         self.mean = np.array(config.DATASET.MEAN, dtype=np.float32)
         self.std = np.array(config.DATASET.STD, dtype=np.float32)
 
+        char_file = config.DATASET.CHAR_FILE
+        with open(char_file, 'rb') as file:
+            char_dict = {num: char.strip().decode('gbk', 'ignore') for num, char in enumerate(file.readlines())}
+
         txt_file = config.DATASET.JSON_FILE['train'] if is_train else config.DATASET.JSON_FILE['val']
-        # create train/val split
+
+        # convert name:indices to name:string
+        self.labels = []
         with open(txt_file, 'r', encoding='utf-8') as file:
-            self.labels = [{c.split(' ')[0]: c.split(' ')[-1][:-1]} for c in file.readlines()]
+            contents = file.readlines()
+            for c in contents:
+                imgname = c.split(' ')[0]
+                indices = c.split(' ')[1:]
+                string = ''.join([char_dict[int(idx)] for idx in indices])
+                self.labels.append({imgname: string})
 
         print("load {} images!".format(self.__len__()))
 

BIN
lib/dataset/__pycache__/_360cc.cpython-35.pyc


BIN
lib/utils/__pycache__/utils.cpython-35.pyc


+ 34 - 0
lib/utils/preprocessing.py

@@ -0,0 +1,34 @@
+'''
+360万中文训练集标签修改
+'''
+
+# chinese characters dictionary for 3.6 million data set.
+with open('../char_std_5990.txt', 'rb') as file:
+	char_dict = {num : char.strip().decode('gbk','ignore') for num, char in enumerate(file.readlines())}
+
+# processing output
+with open('../test.txt') as file:
+	value_list = ['%s %s'%(segment_list.split(' ')[0], ''.join([char_dict[int(val)] for val in segment_list[:-1].split(' ')[1:]])) for segment_list in file.readlines()]
+
+# final output
+with open('test.txt', 'w', encoding='utf-8') as file:
+	[file.write(val+'\n') for val in value_list]
+
+'''
+orginal version
+'''
+
+# with open('../char_std_5990.txt', 'rb') as file:
+# 	char_dict = {num : char.strip().decode('gbk','ignore') for num, char in enumerate(file.readlines())}
+
+#  value_list = []
+# with open('../test.txt') as file:
+# 	label_list = file.readlines()
+# 	for segment_list in label_list:
+# 		key = segment_list.split(' ')[0]
+# 		segment_list = segment_list[:-1].split(' ')[1:]
+# 		temp = [char_dict[int(val)] for val in segment_list]
+# 		value_list.append('%s %s'%(key, ''.join(temp)))
+	
+# with open('test.txt', 'w', encoding='utf-8') as file:
+# 	[ file.write(val+'\n') for val in value_list]

+ 5 - 1
lib/utils/utils.py

@@ -146,4 +146,8 @@ class strLabelConverter(object):
                     self.decode(
                         t[index:index + l], torch.IntTensor([l]), raw=raw))
                 index += l
-            return texts
+            return texts
+
+def get_char_dict(path):
+    with open(path, 'rb') as file:
+        char_dict = {num: char.strip().decode('gbk', 'ignore') for num, char in enumerate(file.readlines())}

BIN
output/360CC/crnn/2020-03-22-05-07/log/events.out.tfevents.1584824864.DESKTOP-LVNAKHJ


BIN
output/360CC/crnn/2020-03-22-05-08/log/events.out.tfevents.1584824890.DESKTOP-LVNAKHJ


BIN
output/360CC/crnn/2020-03-22-05-10/log/events.out.tfevents.1584825013.DESKTOP-LVNAKHJ


BIN
output/360CC/crnn/2020-03-22-05-10/log/events.out.tfevents.1584825054.DESKTOP-LVNAKHJ


BIN
output/360CC/crnn/2020-03-22-05-11/log/events.out.tfevents.1584825089.DESKTOP-LVNAKHJ


BIN
output/360CC/crnn/2020-03-22-05-12/log/events.out.tfevents.1584825129.DESKTOP-LVNAKHJ


BIN
output/360CC/crnn/2020-03-22-05-13/log/events.out.tfevents.1584825233.DESKTOP-LVNAKHJ


BIN
output/360CC/crnn/2020-03-22-05-14/log/events.out.tfevents.1584825246.DESKTOP-LVNAKHJ


BIN
output/360CC/crnn/2020-03-22-05-14/log/events.out.tfevents.1584825262.DESKTOP-LVNAKHJ


BIN
output/360CC/crnn/2020-03-22-05-15/log/events.out.tfevents.1584825302.DESKTOP-LVNAKHJ


BIN
output/360CC/crnn/2020-03-22-05-17/log/events.out.tfevents.1584825463.DESKTOP-LVNAKHJ


BIN
output/360CC/crnn/2020-03-22-05-19/checkpoints/checkpoint_0_acc_0.0000.pth


BIN
output/360CC/crnn/2020-03-22-05-19/log/events.out.tfevents.1584825548.DESKTOP-LVNAKHJ


+ 2 - 2
train.py

@@ -108,8 +108,8 @@ def main():
     converter = utils.strLabelConverter(config.DATASET.ALPHABETS)
     for epoch in range(last_epoch, config.TRAIN.END_EPOCH):
 
-        function.train(config, train_loader, train_dataset, converter, model, criterion, optimizer, device, epoch, writer_dict, output_dict)
-        lr_scheduler.step()
+        # function.train(config, train_loader, train_dataset, converter, model, criterion, optimizer, device, epoch, writer_dict, output_dict)
+        # lr_scheduler.step()
 
         acc = function.validate(config, val_loader, val_dataset, converter, model, criterion, device, epoch, writer_dict, output_dict)