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
# | |
# ResNet-50 model training using Keras and Horovod. | |
# | |
import argparse | |
from tensorflow import keras | |
from tensorflow.python.keras import backend as K | |
from tensorflow.keras.preprocessing import image | |
import tensorflow as tf | |
import horovod.tensorflow.keras as hvd |
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
import tensorflow as tf | |
import argparse | |
import os | |
from tqdm import tqdm | |
def validate_record(file_path): | |
print ('Validating record {}'.format(file_path)) | |
count = 0 | |
for example in tf.python_io.tf_record_iterator(file_path): | |
ex = tf.train.Example.FromString(example) |
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
import argparse | |
import collections | |
import os | |
import deepdish as dd | |
import numpy as np | |
import tensorflow as tf | |
from tqdm import tqdm | |
parser = argparse.ArgumentParser() |
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
package sample | |
import java.io.File | |
import scala.io.Source | |
import javax.imageio.ImageIO | |
import org.apache.mxnet._ | |
import org.apache.mxnet.infer.{ImageClassifier, Predictor} | |
object PredictorSample { |
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
package mxnet; | |
import org.apache.mxnet.infer.javaapi.Predictor; | |
import org.apache.mxnet.javaapi.*; | |
import org.apache.mxnet.javaapi.Shape; | |
import javax.imageio.ImageIO; | |
import java.awt.*; | |
import java.awt.image.BufferedImage; | |
import java.io.BufferedReader; |
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
import mxnet as mx | |
from mxnet import ndarray as nd | |
import numpy as np | |
from collections import namedtuple | |
import math | |
Batch = namedtuple('Batch', ['data']) | |
ctx = mx.gpu() | |
use_batch=True | |
num_runs=1000 |
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
package mxnet; | |
import org.apache.mxnet.infer.javaapi.Predictor; | |
import org.apache.mxnet.javaapi.Context; | |
import org.apache.mxnet.javaapi.DType; | |
import org.apache.mxnet.javaapi.DataDesc; | |
import org.apache.mxnet.javaapi.Shape; | |
import javax.imageio.ImageIO; | |
import java.awt.*; |
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
private static BufferedImage loadIamgeFromFile(String inputImagePath) throws IOException { | |
return ImageIO.read(new File(inputImagePath)); | |
} | |
private static BufferedImage reshapeImage(BufferedImage buf, int newWidth, int newHeight) { | |
BufferedImage resizedImage = new BufferedImage(newWidth, newHeight, BufferedImage.TYPE_INT_RGB); | |
Graphics2D g = resizedImage.createGraphics(); | |
g.drawImage(buf, 0, 0, newWidth, newHeight, null); | |
g.dispose(); |
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
{ | |
"nodes": [ | |
{ | |
"op": "null", | |
"name": "data", | |
"inputs": [] | |
}, | |
{ | |
"op": "SliceChannel", | |
"name": "myblock0_split0", |
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
#!/usr/bin/env python | |
# Licensed under the Apache License, Version 2.0 (the "License"). | |
# You may not use this file except in compliance with the License. | |
# A copy of the License is located at | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# or in the "license" file accompanying this file. This file is distributed | |
# on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | |
# express or implied. See the License for the specific language governing | |
# permissions and limitations under the License. |
NewerOlder