#!/bin/bash # Download weights DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" if [ ! -d $DIR/../weights ]; then mkdir $DIR/../weights fi cd $DIR/../weights if [ ! -e bvlc_alexnet.caffemodel ]; then wget http://dl.caffe.berkeleyvision.org/bvlc_alexnet.caffemodel fi if [ ! -e bvlc_googlenet.caffemodel ]; then wget http://dl.caffe.berkeleyvision.org/bvlc_googlenet.caffemodel fi if [ ! -e VGG_ILSVRC_16_layers.caffemodel ]; then wget http://www.robots.ox.ac.uk/~vgg/software/very_deep/caffe/VGG_ILSVRC_16_layers.caffemodel fi cd -改为Windows下的bat文件
时间: 2023-12-24 10:04:17 浏览: 155
您可以将上面的脚本内容保存为一个 `.bat` 文件,并进行如下修改:
```
@echo off
:: Download weights
set "DIR=%~dp0"
if not exist "%DIR%\..\weights" mkdir "%DIR%\..\weights"
cd /d "%DIR%\..\weights"
if not exist bvlc_alexnet.caffemodel (
powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://dl.caffe.berkeleyvision.org/bvlc_alexnet.caffemodel', '%CD%\bvlc_alexnet.caffemodel')"
)
if not exist bvlc_googlenet.caffemodel (
powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://dl.caffe.berkeleyvision.org/bvlc_googlenet.caffemodel', '%CD%\bvlc_googlenet.caffemodel')"
)
if not exist VGG_ILSVRC_16_layers.caffemodel (
powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://www.robots.ox.ac.uk/~vgg/software/very_deep/caffe/VGG_ILSVRC_16_layers.caffemodel', '%CD%\VGG_ILSVRC_16_layers.caffemodel')"
)
cd /d "%~dp0"
```
其中,`%~dp0` 表示当前脚本所在的目录,`if not exist` 语句用于判断文件是否存在,如果不存在则使用 `powershell` 命令下载。注意,Windows 下无法直接使用 `wget` 命令,需要使用 `powershell` 命令来进行下载。
阅读全文