milselarch commited on
Commit
abca1b7
1 Parent(s): f2764b1

Upload folder using huggingface_hub

Browse files
.hugignore CHANGED
@@ -1,6 +1,9 @@
1
  **/*.zip
 
 
2
  **/__MACOSX
3
  GRID-dataset.zip
 
4
  models/**
5
  venv/**
6
  config.yml
 
1
  **/*.zip
2
+ **/*.mpg
3
+ **/*.align
4
  **/__MACOSX
5
  GRID-dataset.zip
6
+ GRID-dataset/**
7
  models/**
8
  venv/**
9
  config.yml
.idea/workspace.xml CHANGED
@@ -5,14 +5,9 @@
5
  </component>
6
  <component name="ChangeListManager">
7
  <list default="true" id="98e215cf-e237-4c1b-a854-08c5c8eeb9db" name="Changes" comment="">
8
- <change afterPath="$PROJECT_DIR$/.hugignore" afterDir="false" />
9
- <change afterPath="$PROJECT_DIR$/check_videos.py" afterDir="false" />
10
- <change afterPath="$PROJECT_DIR$/model.py" afterDir="false" />
11
- <change afterPath="$PROJECT_DIR$/upload.py" afterDir="false" />
12
- <change beforePath="$PROJECT_DIR$/.gitignore" beforeDir="false" afterPath="$PROJECT_DIR$/.gitignore" afterDir="false" />
13
- <change beforePath="$PROJECT_DIR$/Loader.py" beforeDir="false" afterPath="$PROJECT_DIR$/Loader.py" afterDir="false" />
14
  <change beforePath="$PROJECT_DIR$/helpers.py" beforeDir="false" afterPath="$PROJECT_DIR$/helpers.py" afterDir="false" />
15
- <change beforePath="$PROJECT_DIR$/train.py" beforeDir="false" afterPath="$PROJECT_DIR$/train.py" afterDir="false" />
16
  </list>
17
  <option name="SHOW_DIALOG" value="false" />
18
  <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -72,7 +67,10 @@
72
  <updated>1698473948341</updated>
73
  <workItem from="1698473950406" duration="11154000" />
74
  <workItem from="1698545246834" duration="6111000" />
75
- <workItem from="1698579018554" duration="12142000" />
 
 
 
76
  </task>
77
  <servers />
78
  </component>
 
5
  </component>
6
  <component name="ChangeListManager">
7
  <list default="true" id="98e215cf-e237-4c1b-a854-08c5c8eeb9db" name="Changes" comment="">
8
+ <change beforePath="$PROJECT_DIR$/check_videos.py" beforeDir="false" afterPath="$PROJECT_DIR$/check_videos.py" afterDir="false" />
9
+ <change beforePath="$PROJECT_DIR$/corrupted.txt" beforeDir="false" afterPath="$PROJECT_DIR$/corrupted.txt" afterDir="false" />
 
 
 
 
10
  <change beforePath="$PROJECT_DIR$/helpers.py" beforeDir="false" afterPath="$PROJECT_DIR$/helpers.py" afterDir="false" />
 
11
  </list>
12
  <option name="SHOW_DIALOG" value="false" />
13
  <option name="HIGHLIGHT_CONFLICTS" value="true" />
 
67
  <updated>1698473948341</updated>
68
  <workItem from="1698473950406" duration="11154000" />
69
  <workItem from="1698545246834" duration="6111000" />
70
+ <workItem from="1698579018554" duration="14141000" />
71
+ <workItem from="1698650359117" duration="2013000" />
72
+ <workItem from="1698671103984" duration="599000" />
73
+ <workItem from="1698775864388" duration="1213000" />
74
  </task>
75
  <servers />
76
  </component>
__pycache__/helpers.cpython-39.pyc CHANGED
Binary files a/__pycache__/helpers.cpython-39.pyc and b/__pycache__/helpers.cpython-39.pyc differ
 
check_videos.py CHANGED
@@ -11,11 +11,11 @@ corrupted_videos = []
11
  for video_path in tqdm(all_videos):
12
  try:
13
  load_video(video_path)
14
- except (cv2.error, ValueError) as e:
15
  corrupted_videos.append(video_path)
16
  print('corrupted video', video_path)
17
 
18
  print(f'corrupted videos: {len(corrupted_videos)}')
19
- record_file = open('corrupted.txt', 'w')
20
  record_file.write('\n'.join(corrupted_videos))
21
  record_file.close()
 
11
  for video_path in tqdm(all_videos):
12
  try:
13
  load_video(video_path)
14
+ except Exception as e:
15
  corrupted_videos.append(video_path)
16
  print('corrupted video', video_path)
17
 
18
  print(f'corrupted videos: {len(corrupted_videos)}')
19
+ record_file = open('corrupted-videos.txt', 'w')
20
  record_file.write('\n'.join(corrupted_videos))
21
  record_file.close()
corrupted.txt CHANGED
@@ -1,107 +0,0 @@
1
- GRID-dataset/videos/s8/lgazzs.mpg
2
- GRID-dataset/videos/s8/lbwx9n.mpg
3
- GRID-dataset/videos/s8/lwiyzs.mpg
4
- GRID-dataset/videos/s8/lrwy5n.mpg
5
- GRID-dataset/videos/s8/pbwv6a.mpg
6
- GRID-dataset/videos/s8/bgwn6s.mpg
7
- GRID-dataset/videos/s8/lbip3n.mpg
8
- GRID-dataset/videos/s8/sgih5n.mpg
9
- GRID-dataset/videos/s8/lbbx5n.mpg
10
- GRID-dataset/videos/s8/bgim5p.mpg
11
- GRID-dataset/videos/s8/brwf9n.mpg
12
- GRID-dataset/videos/s8/lrak2a.mpg
13
- GRID-dataset/videos/s8/lbbd6a.mpg
14
- GRID-dataset/videos/s8/sgbo7n.mpg
15
- GRID-dataset/videos/s8/pgbj9n.mpg
16
- GRID-dataset/videos/s8/bwwa2s.mpg
17
- GRID-dataset/videos/s8/srbh4a.mpg
18
- GRID-dataset/videos/s8/bganza.mpg
19
- GRID-dataset/videos/s8/bbie3p.mpg
20
- GRID-dataset/videos/s8/pwwx7p.mpg
21
- GRID-dataset/videos/s8/sran1n.mpg
22
- GRID-dataset/videos/s8/pwwq2s.mpg
23
- GRID-dataset/videos/s8/pbbb8s.mpg
24
- GRID-dataset/videos/s8/lbwy2a.mpg
25
- GRID-dataset/videos/s8/swia6s.mpg
26
- GRID-dataset/videos/s8/prwc9p.mpg
27
- GRID-dataset/videos/s8/bgag6a.mpg
28
- GRID-dataset/videos/s8/prav1n.mpg
29
- GRID-dataset/videos/s8/braz5p.mpg
30
- GRID-dataset/videos/s8/sgih8a.mpg
31
- GRID-dataset/videos/s8/bbir1p.mpg
32
- GRID-dataset/videos/s8/pgwe1p.mpg
33
- GRID-dataset/videos/s8/lrbd9n.mpg
34
- GRID-dataset/videos/s8/pbioza.mpg
35
- GRID-dataset/videos/s8/lrad8a.mpg
36
- GRID-dataset/videos/s8/lgbf4a.mpg
37
- GRID-dataset/videos/s8/sbwn6a.mpg
38
- GRID-dataset/videos/s8/pwav7n.mpg
39
- GRID-dataset/videos/s8/lrid4a.mpg
40
- GRID-dataset/videos/s8/pwii6s.mpg
41
- GRID-dataset/videos/s8/bwwt5p.mpg
42
- GRID-dataset/videos/s8/swit9p.mpg
43
- GRID-dataset/videos/s8/bwaf7n.mpg
44
- GRID-dataset/videos/s8/sgbv2s.mpg
45
- GRID-dataset/videos/s8/pbwc1n.mpg
46
- GRID-dataset/videos/s8/lraq3n.mpg
47
- GRID-dataset/videos/s8/pgwd9n.mpg
48
- GRID-dataset/videos/s8/prii2a.mpg
49
- GRID-dataset/videos/s8/pgbq6a.mpg
50
- GRID-dataset/videos/s8/pwic2s.mpg
51
- GRID-dataset/videos/s8/prwx2a.mpg
52
- GRID-dataset/videos/s8/pwbqza.mpg
53
- GRID-dataset/videos/s8/brie8s.mpg
54
- GRID-dataset/videos/s8/sgbi4s.mpg
55
- GRID-dataset/videos/s8/swwb8s.mpg
56
- GRID-dataset/videos/s8/prio4s.mpg
57
- GRID-dataset/videos/s8/sbaaza.mpg
58
- GRID-dataset/videos/s8/bwbg1n.mpg
59
- GRID-dataset/videos/s8/pwap4s.mpg
60
- GRID-dataset/videos/s8/prwp5n.mpg
61
- GRID-dataset/videos/s8/lbbx6s.mpg
62
- GRID-dataset/videos/s8/lrid1n.mpg
63
- GRID-dataset/videos/s8/lbwd8s.mpg
64
- GRID-dataset/videos/s8/pwic1n.mpg
65
- GRID-dataset/videos/s8/bbirzs.mpg
66
- GRID-dataset/videos/s8/swwv2a.mpg
67
- GRID-dataset/videos/s8/lgar7p.mpg
68
- GRID-dataset/videos/s8/lbaj5p.mpg
69
- GRID-dataset/videos/s8/lbbq2s.mpg
70
- GRID-dataset/videos/s8/lgaz1p.mpg
71
- GRID-dataset/videos/s8/bgwa8s.mpg
72
- GRID-dataset/videos/s8/lbip6a.mpg
73
- GRID-dataset/videos/s8/prao9p.mpg
74
- GRID-dataset/videos/s8/pwbj4s.mpg
75
- GRID-dataset/videos/s8/lgir2s.mpg
76
- GRID-dataset/videos/s8/pwbj6a.mpg
77
- GRID-dataset/videos/s8/srwb1n.mpg
78
- GRID-dataset/videos/s8/sgau7n.mpg
79
- GRID-dataset/videos/s8/bbar6a.mpg
80
- GRID-dataset/videos/s8/bbay9p.mpg
81
- GRID-dataset/videos/s8/lwid8s.mpg
82
- GRID-dataset/videos/s8/pgbd7p.mpg
83
- GRID-dataset/videos/s8/sgao6a.mpg
84
- GRID-dataset/videos/s8/bbik5n.mpg
85
- GRID-dataset/videos/s8/lgiy7p.mpg
86
- GRID-dataset/videos/s8/lwwl6a.mpg
87
- GRID-dataset/videos/s8/pwbp8s.mpg
88
- GRID-dataset/videos/s8/swihzs.mpg
89
- GRID-dataset/videos/s8/brbf7p.mpg
90
- GRID-dataset/videos/s8/lwak7p.mpg
91
- GRID-dataset/videos/s8/brwg2a.mpg
92
- GRID-dataset/videos/s8/lwwz3p.mpg
93
- GRID-dataset/videos/s8/prwj3p.mpg
94
- GRID-dataset/videos/s8/sgai1p.mpg
95
- GRID-dataset/videos/s8/pbau5n.mpg
96
- GRID-dataset/videos/s8/swbh8s.mpg
97
- GRID-dataset/videos/s8/brbz9p.mpg
98
- GRID-dataset/videos/s8/brbm1p.mpg
99
- GRID-dataset/videos/s8/srag8s.mpg
100
- GRID-dataset/videos/s8/lwae1n.mpg
101
- GRID-dataset/videos/s8/lrip9n.mpg
102
- GRID-dataset/videos/s8/srbh1n.mpg
103
- GRID-dataset/videos/s8/lwae4a.mpg
104
- GRID-dataset/videos/s8/swih2a.mpg
105
- GRID-dataset/videos/s8/pbab6a.mpg
106
- GRID-dataset/videos/s8/sbigza.mpg
107
- GRID-dataset/videos/s8/pwiv5p.mpg
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
helpers.py CHANGED
@@ -21,12 +21,23 @@ num_to_char = tf.keras.layers.StringLookup(
21
 
22
 
23
  def load_video(path: str) -> List[float]:
 
 
 
 
24
  cap = cv2.VideoCapture(path)
25
  frames = []
26
- for _ in range(int(cap.get(cv2.CAP_PROP_FRAME_COUNT))):
 
 
27
  ret, frame = cap.read()
28
- frame = tf.image.rgb_to_grayscale(frame)
29
- frames.append(frame[190:236, 80:220, :])
 
 
 
 
 
30
  cap.release()
31
 
32
  mean = tf.math.reduce_mean(frames)
 
21
 
22
 
23
  def load_video(path: str) -> List[float]:
24
+ """
25
+ adapted original loading code using this tutorial about openCV
26
+ https://learnopencv.com/read-write-and-display-a-video-using-opencv-cpp-python/
27
+ """
28
  cap = cv2.VideoCapture(path)
29
  frames = []
30
+ ret = True
31
+
32
+ while cap.isOpened():
33
  ret, frame = cap.read()
34
+
35
+ if ret is True:
36
+ frame = tf.image.rgb_to_grayscale(frame)
37
+ frames.append(frame[190:236, 80:220, :])
38
+ else:
39
+ break
40
+
41
  cap.release()
42
 
43
  mean = tf.math.reduce_mean(frames)
upload.py CHANGED
@@ -7,5 +7,5 @@ api.upload_folder(
7
  folder_path="./",
8
  repo_id="SilentSpeak/lipnet",
9
  repo_type="model",
10
- ignore_patterns=open('.gitignore').read().split('\n')
11
  )
 
7
  folder_path="./",
8
  repo_id="SilentSpeak/lipnet",
9
  repo_type="model",
10
+ ignore_patterns=open('.hugignore').read().split('\n')
11
  )