-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #194 from roboflow/upload-tests
Sharpen the axe - shell tests baked in
- Loading branch information
Showing
8 changed files
with
106 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -142,6 +142,7 @@ cython_debug/ | |
|
||
#config stuff | ||
tests/config.json | ||
tests/manual/data | ||
|
||
#dataset download stuff | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import argparse | ||
import roboflow | ||
|
||
def login(args): | ||
roboflow.login() | ||
|
||
def download(args): | ||
rf = roboflow.Roboflow() | ||
w, p, v = args.datasetUrl.split("/") | ||
format, location = args.f, args.l | ||
project = rf.workspace(w).project(p) | ||
project.version(int(v)).download(format, location=location, overwrite=True) | ||
|
||
def upload(args): | ||
rf = roboflow.Roboflow() | ||
f, w, p, folder = args.f, args.w, args.p, args.folder | ||
workspace = rf.workspace(w) | ||
workspace.upload_dataset( | ||
dataset_path=folder, | ||
dataset_format=f, | ||
project_name=p, | ||
) | ||
|
||
def _argparser(): | ||
parser = argparse.ArgumentParser(description="main description") | ||
subparsers = parser.add_subparsers(title="subcommands") | ||
login_parser = subparsers.add_parser("login", help="Log in to Roboflow") | ||
login_parser.set_defaults(func=login) | ||
download_parser = subparsers.add_parser("download", help="Download a dataset version from your workspace or Roboflow Universe.") | ||
download_parser.add_argument("datasetUrl", help="Dataset URL (e.g., `roboflow-100/cells-uyemf/2`)") | ||
download_parser.add_argument("-f", | ||
choices=["coco", "yolov5pytorch", "yolov7pytorch", "my-yolov6", "darknet", "voc", "tfrecord", | ||
"createml", "clip", "multiclass", "coco-segmentation", "yolo5-obb", "png-mask-semantic", "yolov8"], | ||
help="Specify the format to download the version in (default: interactive prompt)") | ||
download_parser.add_argument("-l", help="Location to download the dataset") | ||
download_parser.set_defaults(func=download) | ||
upload_parser = subparsers.add_parser("upload", help="Upload a dataset") | ||
upload_parser.add_argument("folder", help="filesystem path to a folder that contains your dataset") | ||
upload_parser.add_argument("-w", help="workspace url") | ||
upload_parser.add_argument("-p", help="Project name") | ||
upload_parser.add_argument("-f", choices=["voc", "yolov8", "yolov5"], help="format") | ||
upload_parser.set_defaults(func=upload) | ||
return parser | ||
|
||
def main(): | ||
parser = _argparser() | ||
args = parser.parse_args() | ||
if hasattr(args, 'func'): | ||
args.func(args) | ||
else: | ||
parser.print_help() | ||
|
||
if __name__ == "__main__": | ||
main() |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import sys | ||
import os | ||
|
||
thisdir = os.path.dirname(os.path.abspath(__file__)) | ||
rootdir = os.path.abspath(f"{thisdir}/../..") | ||
os.environ["ROBOFLOW_CONFIG_DIR"] = f"{thisdir}/data/.config" | ||
sys.path.append(rootdir) | ||
|
||
from roboflowpy import _argparser | ||
|
||
if __name__ == "__main__": | ||
parser = _argparser() | ||
args = parser.parse_args(["login"]) | ||
# args = parser.parse_args( | ||
# [ | ||
# "upload", | ||
# "./data/cultura-pepino-voc", | ||
# "-w", | ||
# "wolfodorpythontests", | ||
# "-p", | ||
# "cultura-pepino-upload-test-voc", | ||
# "-f", | ||
# "voc", | ||
# ] | ||
# ) | ||
args.func(args) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
export ROBOFLOW_CONFIG_DIR=./data/.config | ||
# python ../../roboflowpy.py download motusbots/cultura-pepino/2 -f coco -l ./data/cultura-pepino-coco | ||
# python ../../roboflowpy.py download motusbots/cultura-pepino/2 -f yolov5pytorch -l ./data/cultura-pepino-yolov5pytorch | ||
# python ../../roboflowpy.py download motusbots/cultura-pepino/2 -f yolov7pytorch -l ./data/cultura-pepino-yolov7pytorch | ||
# python ../../roboflowpy.py download motusbots/cultura-pepino/2 -f my-yolov6 -l ./data/cultura-pepino-my-yolov6 | ||
# python ../../roboflowpy.py download motusbots/cultura-pepino/2 -f darknet -l ./data/cultura-pepino-darknet | ||
# python ../../roboflowpy.py download motusbots/cultura-pepino/2 -f voc -l ./data/cultura-pepino-voc | ||
# python ../../roboflowpy.py download motusbots/cultura-pepino/2 -f tfrecord -l ./data/cultura-pepino-tfrecord | ||
# python ../../roboflowpy.py download motusbots/cultura-pepino/2 -f createml -l ./data/cultura-pepino-createml | ||
# python ../../roboflowpy.py download motusbots/cultura-pepino/2 -f clip -l ./data/cultura-pepino-clip | ||
# python ../../roboflowpy.py download motusbots/cultura-pepino/2 -f multiclass -l ./data/cultura-pepino-multiclass | ||
# python ../../roboflowpy.py download motusbots/cultura-pepino/2 -f coco-segmentation -l ./data/cultura-pepino-coco-segmentation | ||
# python ../../roboflowpy.py download motusbots/cultura-pepino/2 -f yolo5-obb -l ./data/cultura-pepino-yolo5-obb | ||
python ../../roboflowpy.py download motusbots/cultura-pepino/2 -f yolov8 -l ./data/cultura-pepino-yolov8 | ||
# python ../../roboflowpy.py download motusbots/cultura-pepino/2 -f png-mask-semantic -l ./data/cultura-pepino-png-mask-semantic |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export ROBOFLOW_CONFIG_DIR=./data/.config | ||
python ../../roboflowpy.py login |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export ROBOFLOW_CONFIG_DIR=./data/.config | ||
# python ../../roboflowpy.py upload ./data/cultura-pepino-voc -w wolfodorpythontests -p cultura-pepino-upload-test-voc -f voc | ||
python ../../roboflowpy.py upload ./data/cultura-pepino-yolov8 -w wolfodorpythontests -p cultura-pepino-upload-test-yolov8 -f yolov8 | ||
# python ../../roboflowpy.py upload ./data/cultura-pepino-yolov5pytorch -w wolfodorpythontests -p cultura-pepino-upload-test-yolov5 -f yolov5 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export API_URL=https://api.roboflow.com | ||
export APP_URL=https://app.roboflow.com |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export API_URL=https://api.roboflow.one | ||
export APP_URL=https://app.roboflow.one |