Comments (3)
Hi,
this is old tensorflow code (2017), but hopefully still helpful:
def assign_from_checkpoint_2d_to_3d_scale(model_path, var_list):
"""Creates an operation to assign specific variables from a checkpoint.
Args:
model_path: The full path to the model checkpoint. To get latest checkpoint
use model_path = tf.train.latest_checkpoint(checkpoint_dir)
var_list: A list of Variable
objects or a dictionary mapping names in the
checkpoint to the corresponding variables to initialize. If empty or
None, it would return no_op(), None.
Returns:
the restore_op and the feed_dict that need to be run to restore var_list.
Raises:
ValueError: If the checkpoint specified at model_path
is missing one of
the variables in var_list
.
"""
reader = pywrap_tensorflow.NewCheckpointReader(model_path)
if isinstance(var_list, (tuple, list)):
var_list = {var.op.name: var for var in var_list}
feed_dict = {}
assign_ops = []
for checkpoint_var_name in var_list:
var = var_list[checkpoint_var_name]
if not reader.has_tensor(checkpoint_var_name):
raise ValueError(
'Checkpoint is missing variable [%s]' % checkpoint_var_name)
var_value = reader.get_tensor(checkpoint_var_name)
placeholder_name = 'placeholder/' + var.op.name
placeholder_value = tf.placeholder(
dtype=var.dtype.base_dtype,
shape=var.get_shape(),
name=placeholder_name)
assign_ops.append(var.assign(placeholder_value))
if var.get_shape() != var_value.shape:
n = var_value.shape[0]
feed_dict[placeholder_value] = np.tile(np.expand_dims(var_value/n,0), [n,1,1,1,1])
else:
feed_dict[placeholder_value] = var_value.reshape(var.get_shape())
assign_op = tf.group(*assign_ops)
return assign_op, feed_dict
from kinetics-i3d.
Thank you very much!
Is there bn/gn parameter in the pretrained 2D model? if so, do we need to ignore it or also load it to the I3D model?
from kinetics-i3d.
from kinetics-i3d.
Related Issues (20)
- Optical flow rescaling HOT 5
- How to create a custom action recognition model HOT 2
- Inflating pre-trained models HOT 1
- Trying to create frozen graph, so i can convert it into tflite for android
- Training with different architectures
- customize actions class in the model HOT 1
- offline usage
- rgb.npy and flow.npy HOT 3
- training from scratch HOT 2
- which one is the checkpoint? HOT 5
- The problem of receptive field in I3D paper
- missing videos
- Does the video need to be cropped? HOT 11
- Calculation of TV L1 flow HOT 1
- dependencies issues HOT 1
- Struggling to learn using Opt. Flow HOT 2
- Incompatibility issues
- Run time of I3D on edge decives
- Is there Model File(.pth or .pt) that pretrained with Imagenet+Kinetics?
- I found the pth file which pretrained on Kinetics400 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kinetics-i3d.