Question regarding Video Classifier. #2415
Unanswered
alitirmizi6200
asked this question in
General
Replies: 1 comment
-
Seems like you are using default backend, which is tensorflow. And it doesn't have model.summary() n_parameters = model.count_params()
print("number of params (M): %.2f" % (n_parameters / 1.0e6)) And as mentioned, if you swith to torch backend, then the following should work also n_parameters = sum(p.numel() for p in model.parameters() if p.requires_grad)
print("number of params (M): %.2f" % (n_parameters / 1.0e6)) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
So, I was following our brother Innat's work. His notebooks regarding video swin transformer. I am fairly new to python. So untill te migration happens of Innat's keras_cs repo to Keras_team repo, Code was executing just fine but know it shows error's like model.parameters() not found or model.train() not found.
I am sharing relevant code from notebook.
`import keras
from keras import ops
from keras_cv.models import VideoSwinBackbone
from keras_cv.models import VideoClassifier
keras.version # i.e 3.0.5'
def vswin_tiny():
backbone=VideoSwinBackbone(
input_shape=(32, 224, 224, 3),
embed_dim=96,
depths=[2, 2, 6, 2],
num_heads=[3, 6, 12, 24],
include_rescaling=False,
)
backbone.load_weights(
'/kaggle/input/videoswin/keras/tiny/1/videoswin_tiny_kinetics400.weights.h5'
)
backbone.trainable = False
keras_model = VideoClassifier(
backbone=backbone,
num_classes=len(class_folders),
activation=None,
pooling='avg',
)
return keras_model
model = vswin_tiny()
optimizer = torch.optim.Adam(
model.parameters(), lr=1e-3
)`
AttributeError: 'VideoClassifier' object has no attribute 'parameters'
Hope this was correct format, If I am doing anything wrong, guide me.
Beta Was this translation helpful? Give feedback.
All reactions