diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 57370551..69a37f29 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -8,3 +8,13 @@ updates: schedule: # Check for updates to GitHub Actions every weekday interval: "daily" + labels: + - "ci" + - package-ecosystem: "gitsubmodule" + directory: "/" + schedule: + # Check for updates to git submodule every weekday + interval: "daily" + labels: + - "ci" + - "submodules" \ No newline at end of file diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 9070d9cb..84ad45d6 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -9,10 +9,11 @@ jobs: job: runs-on: ubuntu-latest steps: - - name: Checkout + - name: Checkout repository and submodules uses: actions/checkout@v2.3.4 with: persist-credentials: false + submodules: recursive - name: Lint run: | diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..64fd1446 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "test-data"] + path = test-data + url = https://github.com/webmachinelearning/test-data diff --git a/README.md b/README.md index df7c7823..4db3091e 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,8 @@ ### Setup & Run ```sh -> npm install +> git clone --recurse-submodules https://github.com/webmachinelearning/webnn-samples +> cd webnn-samples & npm install > npm start ``` diff --git a/image_classification/mobilenet_nchw.js b/image_classification/mobilenet_nchw.js index 793a2dcc..9558cd46 100644 --- a/image_classification/mobilenet_nchw.js +++ b/image_classification/mobilenet_nchw.js @@ -7,8 +7,7 @@ export class MobileNetV2Nchw { constructor() { this.builder_ = null; this.graph_ = null; - this.weightsUrl_ = 'https://webmachinelearning.github.io/test-data/' + - 'models/mobilenetv2_nchw/weights/'; + this.weightsUrl_ = '../test-data/models/mobilenetv2_nchw/weights/'; this.inputOptions = { mean: [0.485, 0.456, 0.406], std: [0.229, 0.224, 0.225], diff --git a/image_classification/mobilenet_nhwc.js b/image_classification/mobilenet_nhwc.js index 531566e7..f8e58c86 100644 --- a/image_classification/mobilenet_nhwc.js +++ b/image_classification/mobilenet_nhwc.js @@ -9,8 +9,7 @@ export class MobileNetV2Nhwc { constructor() { this.builder_ = null; this.graph_ = null; - this.weightsUrl_ = 'https://webmachinelearning.github.io/test-data/' + - 'models/mobilenetv2_nhwc/weights/'; + this.weightsUrl_ = '../test-data/models/mobilenetv2_nhwc/weights/'; this.inputOptions = { mean: [127.5, 127.5, 127.5], std: [127.5, 127.5, 127.5], diff --git a/image_classification/resnet101v2_nhwc.js b/image_classification/resnet101v2_nhwc.js index 32b03e61..093fa9a8 100644 --- a/image_classification/resnet101v2_nhwc.js +++ b/image_classification/resnet101v2_nhwc.js @@ -11,8 +11,7 @@ export class ResNet101V2Nhwc { constructor() { this.builder_ = null; this.graph_ = null; - this.weightsUrl_ = 'https://webmachinelearning.github.io/test-data/' + - 'models/resnet101v2_nhwc/weights/'; + this.weightsUrl_ = '../test-data/models/resnet101v2_nhwc/weights/'; this.inputOptions = { mean: [127.5, 127.5, 127.5], std: [127.5, 127.5, 127.5], diff --git a/image_classification/resnet50v2_nchw.js b/image_classification/resnet50v2_nchw.js index c960b9ac..5a62d029 100644 --- a/image_classification/resnet50v2_nchw.js +++ b/image_classification/resnet50v2_nchw.js @@ -7,8 +7,7 @@ export class ResNet50V2Nchw { constructor() { this.builder_ = null; this.graph_ = null; - this.weightsUrl_ = 'https://webmachinelearning.github.io/test-data/' + - 'models/resnet50v2_nchw/weights/'; + this.weightsUrl_ = '../test-data/models/resnet50v2_nchw/weights/'; this.inputOptions = { mean: [0.485, 0.456, 0.406], std: [0.229, 0.224, 0.225], diff --git a/image_classification/squeezenet_nchw.js b/image_classification/squeezenet_nchw.js index 6b0b8324..39118ee5 100644 --- a/image_classification/squeezenet_nchw.js +++ b/image_classification/squeezenet_nchw.js @@ -7,8 +7,7 @@ export class SqueezeNetNchw { constructor() { this.builder_ = null; this.graph_ = null; - this.weightsUrl_ = 'https://webmachinelearning.github.io/test-data/' + - 'models/squeezenet1.1_nchw/weights/'; + this.weightsUrl_ = '../test-data/models/squeezenet1.1_nchw/weights/'; this.inputOptions = { mean: [0.485, 0.456, 0.406], std: [0.229, 0.224, 0.225], diff --git a/image_classification/squeezenet_nhwc.js b/image_classification/squeezenet_nhwc.js index 5c490d48..b095138d 100644 --- a/image_classification/squeezenet_nhwc.js +++ b/image_classification/squeezenet_nhwc.js @@ -7,8 +7,7 @@ export class SqueezeNetNhwc { constructor() { this.builder_ = null; this.graph_ = null; - this.weightsUrl_ = 'https://webmachinelearning.github.io/test-data/' + - 'models/squeezenet1.0_nhwc/weights/'; + this.weightsUrl_ = '../test-data/models/squeezenet1.0_nhwc/weights/'; this.inputOptions = { mean: [127.5, 127.5, 127.5], std: [127.5, 127.5, 127.5], diff --git a/lenet/main.js b/lenet/main.js index e02e5602..dc8fbb0c 100644 --- a/lenet/main.js +++ b/lenet/main.js @@ -56,8 +56,7 @@ function clearResult() { export async function main() { drawNextDigitFromMnist(); const pen = new Pen(visualCanvas); - const weightUrl = 'https://webmachinelearning.github.io/test-data/' + - 'models/lenet_nchw/weights/lenet.bin'; + const weightUrl = '../test-data/models/lenet_nchw/weights/lenet.bin'; const lenet = new LeNet(weightUrl); try { let start = performance.now(); diff --git a/nsnet2/denoiser.js b/nsnet2/denoiser.js index 17ba6723..2a786de8 100644 --- a/nsnet2/denoiser.js +++ b/nsnet2/denoiser.js @@ -29,8 +29,7 @@ export class Denoiser { return new Promise((resolve, reject) => { this.log(' - Loading weights... '); const start = performance.now(); - const weightsUrl = 'https://webmachinelearning.github.io/test-data/' + - 'models/nsnet2_nchw/weights/'; + const weightsUrl = '../test-data/models/nsnet2_nchw/weights/'; this.nsnet.load( weightsUrl, this.batchSize, this.frames).then((outputOperand) => { const modelLoadTime = performance.now() - start; diff --git a/object_detection/ssd_mobilenetv1_nchw.js b/object_detection/ssd_mobilenetv1_nchw.js index cc3f35bd..1916f911 100644 --- a/object_detection/ssd_mobilenetv1_nchw.js +++ b/object_detection/ssd_mobilenetv1_nchw.js @@ -2,17 +2,15 @@ import {buildConstantByNpy} from '../common/utils.js'; -const testDataURL = 'https://webmachinelearning.github.io/test-data'; - // SSD MobileNet V1 model with 'nchw' layout, trained on the COCO dataset. export class SsdMobilenetV1Nchw { constructor() { this.model_ = null; this.builder_ = null; this.graph_ = null; - this.weightsUrl_ = testDataURL + '/models/ssd_mobilenetv1_nchw/weights/'; + this.weightsUrl_ = '../test-data/models/ssd_mobilenetv1_nchw/weights/'; // Shares the same bias files with 'nhwc' layout - this.biasUrl_ = testDataURL + '/models/ssd_mobilenetv1_nhwc/weights/'; + this.biasUrl_ = '../test-data/models/ssd_mobilenetv1_nhwc/weights/'; this.inputOptions = { inputLayout: 'nchw', labelUrl: './labels/coco_classes.txt', diff --git a/object_detection/ssd_mobilenetv1_nhwc.js b/object_detection/ssd_mobilenetv1_nhwc.js index 2bec4447..23c784c3 100644 --- a/object_detection/ssd_mobilenetv1_nhwc.js +++ b/object_detection/ssd_mobilenetv1_nhwc.js @@ -8,8 +8,7 @@ export class SsdMobilenetV1Nhwc { this.model_ = null; this.builder_ = null; this.graph_ = null; - this.weightsUrl_ = 'https://webmachinelearning.github.io/test-data/' + - 'models/ssd_mobilenetv1_nhwc/weights/'; + this.weightsUrl_ = '../test-data/models/ssd_mobilenetv1_nhwc/weights/'; this.inputOptions = { inputLayout: 'nhwc', labelUrl: './labels/coco_classes.txt', diff --git a/object_detection/tiny_yolov2_nchw.js b/object_detection/tiny_yolov2_nchw.js index 7f00fa65..6784cfe3 100644 --- a/object_detection/tiny_yolov2_nchw.js +++ b/object_detection/tiny_yolov2_nchw.js @@ -7,8 +7,7 @@ export class TinyYoloV2Nchw { constructor() { this.builder_ = null; this.graph_ = null; - this.weightsUrl_ = 'https://webmachinelearning.github.io/test-data/' + - 'models/tiny_yolov2_nchw/weights/'; + this.weightsUrl_ = '../test-data/models/tiny_yolov2_nchw/weights/'; this.inputOptions = { inputLayout: 'nchw', labelUrl: './labels/pascal_classes.txt', diff --git a/object_detection/tiny_yolov2_nhwc.js b/object_detection/tiny_yolov2_nhwc.js index 2417fb7e..b1f0d99a 100644 --- a/object_detection/tiny_yolov2_nhwc.js +++ b/object_detection/tiny_yolov2_nhwc.js @@ -7,8 +7,7 @@ export class TinyYoloV2Nhwc { constructor() { this.builder_ = null; this.graph_ = null; - this.weightsUrl_ = 'https://webmachinelearning.github.io/test-data/' + - 'models/tiny_yolov2_nhwc/weights/'; + this.weightsUrl_ = '../test-data/models/tiny_yolov2_nhwc/weights/'; this.inputOptions = { inputLayout: 'nhwc', labelUrl: './labels/pascal_classes.txt', diff --git a/style_transfer/fast_style_transfer_net.js b/style_transfer/fast_style_transfer_net.js index fad587b7..d95e5238 100644 --- a/style_transfer/fast_style_transfer_net.js +++ b/style_transfer/fast_style_transfer_net.js @@ -11,8 +11,7 @@ export class FastStyleTransferNet { this.graph_ = null; this.constPow_ = null; this.constAdd_ = null; - this.weightsUrl_ = 'https://webmachinelearning.github.io/test-data/' + - 'models/fast_style_transfer_nchw/weights/'; + this.weightsUrl_ = '../test-data/models/fast_style_transfer_nchw/weights/'; this.inputOptions = { inputDimensions: [1, 3, 540, 540], inputLayout: 'nchw',