This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
clearInterval(aa) | |
function mv() { | |
var found_one = false | |
var primary = 0 | |
let el = document.querySelectorAll('.mlbtv-media-player')[primary] | |
let has_ads = !!el.querySelector('.interruption-link') | |
if (!has_ads) { | |
el.querySelector('video').muted = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
convert logo.png -define icon:auto-resize=64,48,32,16 logo.ico |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with tf.io.TFRecordWriter('examples.tfrecord') as training_file: | |
for features, label in batch: | |
features = { | |
'label': tf.train.Feature(int64_list=tf.train.Int64List(value=[label])), | |
'features': tf.train.Feature(float_list=tf.train.FloatList(value=features)) # expects list, so if numpy use .tolist() and ensure it's 1-D | |
} | |
example_proto = tf.train.Example(features=tf.train.Features(feature=features)) | |
training_file.write(example_proto.SerializeToString()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
label_size = 1 # the length of the previously written label | |
feature_size = 256 # the length of the previously written feature lists | |
def map_fn(serialized_example): | |
feature = { | |
'label': tf.io.FixedLenFeature([label_)size], tf.int64), | |
'features': tf.io.FixedLenFeature([feature_size], tf.float32) | |
} | |
example = tf.io.parse_single_example(serialized_example, feature) | |
features = example['features'] | |
label = tf.cast(example['label'], tf.int32) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Write a ambient, target, and label data to a TFRecords file | |
with tf.io.TFRecordWriter('examples.tfrecord') as training_file: | |
for ambient, target, label in batch: # batch is a list of (ambient, target, label) tuples | |
features = { | |
'label': tf.train.Feature(int64_list=tf.train.Int64List(value=[label])), | |
'ambient': tf.train.Feature(float_list=tf.train.FloatList(value=ambient.tolist())), # ambient is a 1-D np array | |
'target': tf.train.Feature(float_list=tf.train.FloatList(value=target.tolist())) # target is a 1-D np array | |
} | |
example_proto = tf.train.Example(features=tf.train.Features(feature=features)) | |
training_file.write(example_proto.SerializeToString()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Read a TFRecord file into a TF Dataset | |
def map_fn(serialized_example): | |
feature = { | |
'label': tf.io.FixedLenFeature([1], tf.int64), | |
'ambient': tf.io.FixedLenFeature([16000], tf.float32), | |
'target': tf.io.FixedLenFeature([4000], tf.float32) | |
} | |
example = tf.io.parse_single_example(serialized_example, feature) | |
ambient = tf.expand_dims(example['ambient'], 1) | |
target = tf.expand_dims(example['target'], 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# if dataset is not batched | |
# this will take 1 example | |
with (ambient, target), label in dataset.take(1): | |
print("ambient shape", ambient.shape) | |
print("target shape", target.shape) | |
print("label shape", label.shape) | |
ambient_array = ambient.numpy() | |
target_array = target.numpy() | |
label_array = label.numpy() | |
OlderNewer