judith0 commited on
Commit
c18b73b
·
1 Parent(s): f15050b

agregando 0 a 9 cedulas

Browse files
.idea/.gitignore ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # Default ignored files
2
+ /shelf/
3
+ /workspace.xml
.idea/cedulaProfecional_Reverso.iml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="PYTHON_MODULE" version="4">
3
+ <component name="NewModuleRootManager">
4
+ <content url="file://$MODULE_DIR$" />
5
+ <orderEntry type="jdk" jdkName="Python 3.9" jdkType="Python SDK" />
6
+ <orderEntry type="sourceFolder" forTests="false" />
7
+ </component>
8
+ </module>
.idea/inspectionProfiles/Project_Default.xml ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <component name="InspectionProjectProfileManager">
2
+ <profile version="1.0">
3
+ <option name="myName" value="Project Default" />
4
+ <inspection_tool class="PyPackageRequirementsInspection" enabled="true" level="WARNING" enabled_by_default="true">
5
+ <option name="ignoredPackages">
6
+ <value>
7
+ <list size="3">
8
+ <item index="0" class="java.lang.String" itemvalue="huggingface-hub" />
9
+ <item index="1" class="java.lang.String" itemvalue="PyYAML" />
10
+ <item index="2" class="java.lang.String" itemvalue="typing_extensions" />
11
+ </list>
12
+ </value>
13
+ </option>
14
+ </inspection_tool>
15
+ <inspection_tool class="PyPep8Inspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
16
+ <option name="ignoredErrors">
17
+ <list>
18
+ <option value="W605" />
19
+ </list>
20
+ </option>
21
+ </inspection_tool>
22
+ </profile>
23
+ </component>
.idea/inspectionProfiles/profiles_settings.xml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ <component name="InspectionProjectProfileManager">
2
+ <settings>
3
+ <option name="USE_PROJECT_PROFILE" value="false" />
4
+ <version value="1.0" />
5
+ </settings>
6
+ </component>
.idea/misc.xml ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9" project-jdk-type="Python SDK" />
4
+ </project>
.idea/modules.xml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/cedulaProfecional_Reverso.iml" filepath="$PROJECT_DIR$/.idea/cedulaProfecional_Reverso.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
.idea/vcs.xml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="" vcs="Git" />
5
+ </component>
6
+ </project>
cedulaP-donut/train/metadata.jsonl ADDED
File without changes
cedulaP-donut/train/metadata.jsonll ADDED
File without changes
cedulaP-donut/validation/metadata.jsonl ADDED
File without changes
crear.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json
2
+ import os
3
+
4
+ # Ruta de la carpeta donde se guardarán los archivos JSON
5
+ folder_path = "./data/key"
6
+
7
+ # Verificar si la carpeta existe, de lo contrario, crearla
8
+ if not os.path.exists(folder_path):
9
+ os.makedirs(folder_path)
10
+
11
+ for i in range(0, 10):
12
+ data = {
13
+ "professionalId":"",
14
+ "mrz": "",
15
+ "type": "SEP",
16
+ }
17
+
18
+ file_name = f"{i}.json"
19
+ file_path = os.path.join(folder_path, file_name)
20
+
21
+ with open(file_path, 'w') as f:
22
+ json.dump(data, f, indent=4)
23
+
24
+ print(f"Archivo {file_name} creado en {folder_path}.")
25
+
26
+ print("Creación de archivos JSON completada.")
data/img/000.jpg ADDED

Git LFS Details

  • SHA256: 457b70b31c8fcd32132e2ff09223de23739ef364e734f6871f5039aeac7d40e9
  • Pointer size: 130 Bytes
  • Size of remote file: 50 kB
data/img/001.jpg ADDED

Git LFS Details

  • SHA256: ccedb2e90c249c323592347098652542d20fd0a0c894f4da9eda085d32a6a373
  • Pointer size: 131 Bytes
  • Size of remote file: 448 kB
data/img/002.jpg ADDED

Git LFS Details

  • SHA256: 184f3f01af6c290cd38132844550a7625f03ba66448ddb995317535ddd45397c
  • Pointer size: 131 Bytes
  • Size of remote file: 213 kB
data/img/003.jpg ADDED

Git LFS Details

  • SHA256: 70d9e77a9dbfcc13a3e3c6f6711e4485088de683471ab14ff4ea1f9b07c68117
  • Pointer size: 130 Bytes
  • Size of remote file: 21 kB
data/img/004.jpg ADDED

Git LFS Details

  • SHA256: b2b6d1ac726ffed51ba6de22c93088240b3d61cff0b74b6d3898548f6f3630ce
  • Pointer size: 130 Bytes
  • Size of remote file: 94.5 kB
data/img/005.jpg ADDED

Git LFS Details

  • SHA256: 6504abfd0f6f54156e40fe52fe4cd0522d4778d8150038e9efd1f898885490ed
  • Pointer size: 131 Bytes
  • Size of remote file: 220 kB
data/img/006.jpg ADDED

Git LFS Details

  • SHA256: 20de89dedcd209837f35905c4857064830746138774f4f4745c7a41464e5e8a4
  • Pointer size: 131 Bytes
  • Size of remote file: 369 kB
data/img/007.jpg ADDED

Git LFS Details

  • SHA256: 7ad799542e8f07b1aa8ee6633874ccea4923369255bb3385306fa97a910de926
  • Pointer size: 131 Bytes
  • Size of remote file: 581 kB
data/img/008.jpg ADDED

Git LFS Details

  • SHA256: 99731d49fca31e2f610431661ca3cc39a0436f6e9103e6aff73d839b2ac7b3ec
  • Pointer size: 131 Bytes
  • Size of remote file: 257 kB
data/key/000.json ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ {
2
+ "professionalId": "0496176",
3
+ "mrz": "IDMEX0104961768<<CACS941020MTS 9410202M<<<<<<<<<<<<1143897<<6 CAVAZOS<CERECEDO<<SUGUEIRI<AGUA",
4
+ "type": "SEP"
5
+ }
data/key/001.json ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ {
2
+ "professionalId": "9664469",
3
+ "mrz": "IDMEX0096644698<<CAGD840308HDF 8403087H<<<<<<<<<<<<0281913<<9 CARRILLO<GOMEZ<<DIEGO<ARTURO<<",
4
+ "type": "SEP"
5
+ }
data/key/002.json ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ {
2
+ "professionalId": "98590999",
3
+ "mrz": "IDMEX0098590995<<HIEB920119HDF 9201198H<<<<<<<<<<<<0598026<<7 HINOJOSA<ESTRADA<<BRUNO<<<<<<<",
4
+ "type": "SEP"
5
+ }
data/key/003.json ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ {
2
+ "professionalId": "0831542",
3
+ "mrz": "IDMEX0108315428<<RXBE910930HTS 9109308H<<<<<<<<<<<<1561702<<5 ROJAS<BRUNO<<EDGAR<ALEJANDRO<<",
4
+ "type": "SEP"
5
+ }
data/key/004.json ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ {
2
+ "professionalId": "10900935",
3
+ "mrz": "IDMEX0109009353<<AURF920515HDF 9205152H<<<<<<<<<<<<1594859<<4 AGUILAR<REYNOSO<<FRANCISCO<JAV",
4
+ "type": "SEP"
5
+ }
data/key/005.json ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ {
2
+ "professionalId": "10054925",
3
+ "mrz": "IDMEX0100549256<<ROSM890629MTS 8906290M<<<<<<<<<<<<0761390<<6 RODRIGUEZ<SAENZ<<MIRIAM<LETICI",
4
+ "type": "SEP"
5
+ }
data/key/006.json ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ {
2
+ "professionalId": "10578852",
3
+ "mrz": "IDMEX0105788520<<LACV930129HTC 9301294H<<<<<<<<<<<<1167705<<9 LARA<CACERES<<VICTOR<JACINTO<<",
4
+ "type": "SEP"
5
+ }
data/key/007.json ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ {
2
+ "professionalId": "9650366",
3
+ "mrz": "IDMEX0096503661<<MOGD890626HDF 8906267H<<<<<<<<<<<<0268319<<6 MONDRAGON<GOMEZ<<DAVID<RAFAEL<",
4
+ "type": "SEP"
5
+ }
data/key/008.json ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ {
2
+ "professionalId": "9478379",
3
+ "mrz": "IDMEX0094783797<<VIDJ930118MHG 9301180M<<<<<<<<<<<<02452432<<VILLEGAS<DIAZ<<JUDITH<<<<<<<<<",
4
+ "type": "SEP"
5
+ }
data/key/009.json ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ {
2
+ "professionalId": "",
3
+ "mrz": "",
4
+ "type": "SEP"
5
+ }
redimensionar.py ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from PIL import Image
2
+ import os
3
+
4
+ def redimensionar_imagenes(carpeta, nuevo_tamano):
5
+ # Obtener la lista de archivos en la carpeta
6
+ archivos = os.listdir(carpeta)
7
+
8
+ for archivo in archivos:
9
+ # Comprobar si el archivo es una imagen
10
+ if archivo.endswith(('.jpg', '.jpeg', '.png', '.gif')):
11
+ ruta = os.path.join(carpeta, archivo)
12
+
13
+ # Abrir la imagen utilizando PIL
14
+ imagen = Image.open(ruta)
15
+
16
+ # Redimensionar la imagen
17
+ imagen_redimensionada = imagen.resize(nuevo_tamano)
18
+
19
+ # Guardar la imagen redimensionada (sobreescribe la original)
20
+ imagen_redimensionada.save(ruta)
21
+
22
+ print(f"La imagen {archivo} ha sido redimensionada.")
23
+
24
+ # Ruta de la carpeta de imágenes
25
+ ruta_carpeta = "./data/img"
26
+
27
+ # Nuevo tamaño deseado para las imágenes (ancho, alto)
28
+ nuevo_tamano = (960, 1280)
29
+
30
+ # Llamar a la función para redimensionar las imágenes
31
+ redimensionar_imagenes(ruta_carpeta, nuevo_tamano)
tranform.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import json
3
+ import shutil
4
+ from tqdm.notebook import tqdm
5
+ lines = []
6
+ images = []
7
+ i = 1
8
+ for ann in tqdm(os.listdir("./data/key")[150:185]):
9
+ i += 1
10
+ if ann != ".ipynb_checkpoints":
11
+ with open("./data/key/" + ann) as f:
12
+ data = json.load(f)
13
+ images.append(ann[:-4] + "jpg")
14
+ line = {"gt_parse": data}
15
+ lines.append(line)
16
+ with open("cedulaP-donut/train/metadata.jsonll", 'w') as f:
17
+ for i, gt_parse in enumerate(lines):
18
+ line = {"file_name": images[i], "ground_truth": json.dumps(gt_parse)}
19
+ f.write(json.dumps(line) + "\n")
20
+ shutil.copyfile("./data/img/" + images[i], "./cedulaP-donut/train/" + images[i])