Spaces:
Runtime error
Runtime error
Commit
Β·
c7c5d0a
1
Parent(s):
7a44257
Update utils/predict.py
Browse files- utils/predict.py +6 -3
utils/predict.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
from .custom_layers import TransformerEncoder, PositionalEmbedding
|
| 2 |
from .constants import MAX_SEQ_LENGTH, NUM_FEATURES, IMG_SIZE, CLASS_VOCAB
|
| 3 |
from huggingface_hub import from_pretrained_keras
|
| 4 |
from tensorflow import keras
|
|
@@ -7,10 +7,13 @@ import numpy as np
|
|
| 7 |
import imageio
|
| 8 |
import cv2
|
| 9 |
|
| 10 |
-
model = from_pretrained_keras("shivi/video-classification",custom_objects={"PositionalEmbedding":PositionalEmbedding,"TransformerEncoder": TransformerEncoder})
|
| 11 |
|
| 12 |
-
|
| 13 |
|
|
|
|
|
|
|
|
|
|
| 14 |
def build_feature_extractor():
|
| 15 |
feature_extractor = keras.applications.DenseNet121(
|
| 16 |
weights="imagenet",
|
|
|
|
| 1 |
+
#from .custom_layers import TransformerEncoder, PositionalEmbedding
|
| 2 |
from .constants import MAX_SEQ_LENGTH, NUM_FEATURES, IMG_SIZE, CLASS_VOCAB
|
| 3 |
from huggingface_hub import from_pretrained_keras
|
| 4 |
from tensorflow import keras
|
|
|
|
| 7 |
import imageio
|
| 8 |
import cv2
|
| 9 |
|
| 10 |
+
#model = from_pretrained_keras("shivi/video-classification",custom_objects={"PositionalEmbedding":PositionalEmbedding,"TransformerEncoder": TransformerEncoder})
|
| 11 |
|
| 12 |
+
model = from_pretrained_keras("shivi/video-transformers")
|
| 13 |
|
| 14 |
+
"""
|
| 15 |
+
Below code is taken from the Video-Transformers on keras-io example by Sayak Paul
|
| 16 |
+
"""
|
| 17 |
def build_feature_extractor():
|
| 18 |
feature_extractor = keras.applications.DenseNet121(
|
| 19 |
weights="imagenet",
|