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
""" | |
Exports Issues from a specified repository to a CSV file | |
Uses basic authentication (Github username + password) to retrieve Issues | |
from a repository that username has access to. Supports Github API v3. | |
""" | |
import csv | |
import requests | |
import random | |
GITHUB_USER = '' |
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
/* | |
* Licensed to the Apache Software Foundation (ASF) under one or more | |
* contributor license agreements. See the NOTICE file distributed with | |
* this work for additional information regarding copyright ownership. | |
* The ASF licenses this file to You under the Apache License, Version 2.0 | |
* (the "License"); you may not use this file except in compliance with | |
* the License. You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* |
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
def runInferenceOnSingleImage(modelPathPrefix: String, inputImagePath: String, | |
context: Array[Context]): | |
IndexedSeq[IndexedSeq[(String, Float)]] = { | |
val dType = DType.Float32 | |
val inputShape = Shape(1, 3, 32, 32) | |
val inputDescriptor = IndexedSeq(DataDesc("/input_11", inputShape, dType, "NCHW")) | |
// Create object of ImageClassifier class | |
val imgClassifier: ImageClassifier = new |
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
"""Gluon Estimator example on MNIST dataset with simple CNN""" | |
import sys | |
import os | |
import time | |
import mxnet as mx | |
from mxnet import gluon, nd, autograd | |
from mxnet import metric | |
from mxnet.gluon import nn, data | |
from mxnet.gluon.contrib.estimator import Estimator |
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
Epoch 1.4.1 Duration(ms) 1.5.0 Duration(ms) | |
0 230.757866 236.492851 | |
1 222.984238 210.10698 | |
2 201.988141 216.398906 | |
3 180.265748 193.985564 | |
4 186.75808 184.309184 | |
5 175.55141 189.248856 | |
6 176.789087 181.657551 | |
7 175.327701 178.745348 | |
8 170.667204 177.222914 |
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
python build_covid_dataset.py --covid covid-chestxray-dataset --output dataset/covid | |
python sample_kaggle_dataset.py --kaggle chest_xray --output dataset/normal | |
python train_covid19.py --dataset dataset |
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
./gradlew run -Dai.djl.repository.zoo.location=models/saved_model |
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
[main] INFO com.examples.PneumoniaDetection - Diagnose: [ | |
class: "Pneumonia", probability: 0.99310 | |
class: "Normal", probability: 0.00689 | |
] |
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
repositories { | |
jcenter() | |
} | |
dependencies { | |
implementation "ai.djl:api:0.5.0" | |
implementation "ai.djl.tensorflow:tensorflow-api:0.5.0" | |
implementation "ai.djl.tensorflow:tensorflow-engine:0.5.0" | |
runtimeOnly "ai.djl.tensorflow:tensorflow-native-auto:2.1.0" | |
runtimeOnly "org.slf4j:slf4j-simple:1.7.29" | |
testImplementation "junit:junit:4.12" |
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
Criteria<BufferedImage, Classifications> criteria = | |
Criteria.builder() | |
.setTypes(BufferedImage.class, Classifications.class) | |
.optTranslator(new MyTranslator()) | |
.build(); | |
try (ZooModel<BufferedImage, Classifications> model = ModelZoo.loadModel(criteria)) { | |
try (Predictor<BufferedImage, Classifications> predictor = model.newPredictor()) { | |
Classifications result = predictor.predict(image); | |
logger.info("Diagnose:" + result.toString()); | |
} |
OlderNewer