Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Detection/fasterrcnn/data/dataset.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
from __future__ import absolute_import
from __future__ import division

import torch
import torch_mlu
from torch_mlu.utils.model_transfer import transfer
import torch as t
from data.voc_dataset import VOCBboxDataset
from skimage import transform as sktsf
Expand Down
6 changes: 5 additions & 1 deletion Detection/fasterrcnn/eval.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import torch
import torch_mlu
from torch_mlu.utils.model_transfer import transfer

from __future__ import absolute_import

from tqdm import tqdm
Expand Down Expand Up @@ -68,4 +72,4 @@ def main(**kwargs):
if __name__ == '__main__':
import fire

fire.Fire()
fire.Fire()
4 changes: 4 additions & 0 deletions Detection/fasterrcnn/misc/convert_caffe_pretrain.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import torch
import torch_mlu
from torch_mlu.utils.model_transfer import transfer

# code from ruotian luo
# https://github.com/ruotianluo/pytorch-faster-rcnn
import torch
Expand Down
4 changes: 4 additions & 0 deletions Detection/fasterrcnn/misc/train_fast.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import torch
import torch_mlu
from torch_mlu.utils.model_transfer import transfer

import os

import ipdb
Expand Down
4 changes: 4 additions & 0 deletions Detection/fasterrcnn/model/faster_rcnn.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
from __future__ import absolute_import
from __future__ import division
import torch
import torch_mlu
from torch_mlu.utils.model_transfer import transfer

import torch as t
import numpy as np
from utils import array_tool as at
Expand Down
5 changes: 5 additions & 0 deletions Detection/fasterrcnn/model/faster_rcnn_vgg16.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
from __future__ import absolute_import

import torch
import torch_mlu
from torch_mlu.utils.model_transfer import transfer

import torch as t
from torch import nn
from torchvision.models import vgg16
Expand Down
4 changes: 4 additions & 0 deletions Detection/fasterrcnn/model/region_proposal_network.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import torch
import torch_mlu
from torch_mlu.utils.model_transfer import transfer

import numpy as np
from torch.nn import functional as F
import torch as t
Expand Down
4 changes: 4 additions & 0 deletions Detection/fasterrcnn/model/utils/creator_tool.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import torch
import torch_mlu
from torch_mlu.utils.model_transfer import transfer

import numpy as np
import torch
from torchvision.ops import nms
Expand Down
2 changes: 1 addition & 1 deletion Detection/fasterrcnn/run_eval.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -e

export CUDA_VISIBLE_DEVICES=0
export MLU_VISIBLE_DEVICES=0

# 使用环境变量,如果没有提供则使用默认路径
data_dir=${DATA_DIR:-""}
Expand Down
2 changes: 1 addition & 1 deletion Detection/fasterrcnn/run_train.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -e

export CUDA_VISIBLE_DEVICES=0
export MLU_VISIBLE_DEVICES=0

# 使用环境变量,如果没有提供则使用默认路径
data_dir=${DATA_DIR:-""} # data1/shared/Dataset/VOCdevkit
Expand Down
4 changes: 4 additions & 0 deletions Detection/fasterrcnn/train.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
from __future__ import absolute_import

import torch
import torch_mlu
from torch_mlu.utils.model_transfer import transfer

from tqdm import tqdm

from utils.config import opt
Expand Down
4 changes: 4 additions & 0 deletions Detection/fasterrcnn/trainer.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
from __future__ import absolute_import

import torch
import torch_mlu
from torch_mlu.utils.model_transfer import transfer
import os
from collections import namedtuple
import time
Expand Down
4 changes: 4 additions & 0 deletions Detection/fasterrcnn/utils/array_tool.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import torch
import torch_mlu
from torch_mlu.utils.model_transfer import transfer

"""
tools to convert specified type
"""
Expand Down
4 changes: 4 additions & 0 deletions Detection/fasterrcnn/utils/config.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import torch
import torch_mlu
from torch_mlu.utils.model_transfer import transfer

from pprint import pprint


Expand Down
4 changes: 4 additions & 0 deletions Detection/ssd/datasets.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import torch
import torch_mlu
from torch_mlu.utils.model_transfer import transfer

import torch
from torch.utils.data import Dataset
import json
Expand Down
4 changes: 4 additions & 0 deletions Detection/ssd/detect.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import torch
import torch_mlu
from torch_mlu.utils.model_transfer import transfer

from torchvision import transforms
from utils import *
from PIL import Image, ImageDraw, ImageFont
Expand Down
4 changes: 4 additions & 0 deletions Detection/ssd/eval.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import torch
import torch_mlu
from torch_mlu.utils.model_transfer import transfer

import argparse
import torch
from utils import *
Expand Down
4 changes: 4 additions & 0 deletions Detection/ssd/model.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import torch
import torch_mlu
from torch_mlu.utils.model_transfer import transfer

from torch import nn
from utils import *
import torch.nn.functional as F
Expand Down
6 changes: 3 additions & 3 deletions Detection/ssd/run_eval.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
# 确保脚本在遇到错误时停止执行
set -e

# 设置 CUDA 设备
export CUDA_VISIBLE_DEVICES=0
# 设置 mlu 设备
export MLU_VISIBLE_DEVICES=0

# 获取环境变量,并将 ARCH 转换为小写
DATA_DIR=${DATA_DIR:-""}
Expand Down Expand Up @@ -58,4 +58,4 @@ python eval.py --checkpoint "$CKPT_PATH"

echo "Evaluate SSD FINISHED"

# mAP 0.771
# mAP 0.771
4 changes: 2 additions & 2 deletions Detection/ssd/run_train.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
# 确保脚本在遇到错误时停止执行
set -e

# 设置 CUDA 设备
export CUDA_VISIBLE_DEVICES=0
# 设置 mlu 设备
export MLU_VISIBLE_DEVICES=0

# 获取环境变量,并将 ARCH 转换为小写
DATA_DIR=${DATA_DIR:-""}
Expand Down
4 changes: 4 additions & 0 deletions Detection/ssd/train.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import torch
import torch_mlu
from torch_mlu.utils.model_transfer import transfer

import time
import torch.backends.cudnn as cudnn
import torch.optim
Expand Down
2 changes: 2 additions & 0 deletions Detection/ssd/utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import json
import os
import torch
import torch_mlu
from torch_mlu.utils.model_transfer import transfer
import random
import xml.etree.ElementTree as ET
import torchvision.transforms.functional as FT
Expand Down
4 changes: 4 additions & 0 deletions Detection/yolo/detect.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import torch
import torch_mlu
from torch_mlu.utils.model_transfer import transfer

# Ultralytics YOLOv5 , AGPL-3.0 license
"""
Run YOLOv5 detection inference on images, videos, directories, globs, YouTube, webcam, streams, etc.
Expand Down
4 changes: 4 additions & 0 deletions Detection/yolo/export.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import torch
import torch_mlu
from torch_mlu.utils.model_transfer import transfer

# Ultralytics YOLOv5 🚀, AGPL-3.0 license
"""
Export a YOLOv5 PyTorch model to other formats. TensorFlow exports authored by https://github.com/zldrobit
Expand Down
4 changes: 4 additions & 0 deletions Detection/yolo/models/common.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import torch
import torch_mlu
from torch_mlu.utils.model_transfer import transfer

# Ultralytics YOLOv5 🚀, AGPL-3.0 license
"""Common modules."""

Expand Down
4 changes: 4 additions & 0 deletions Detection/yolo/models/experimental.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import torch
import torch_mlu
from torch_mlu.utils.model_transfer import transfer

# Ultralytics YOLOv5 🚀, AGPL-3.0 license
"""Experimental modules."""

Expand Down
4 changes: 4 additions & 0 deletions Detection/yolo/models/tf.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import torch
import torch_mlu
from torch_mlu.utils.model_transfer import transfer

# Ultralytics YOLOv5 🚀, AGPL-3.0 license
"""
TensorFlow, Keras and TFLite versions of YOLOv5
Expand Down
4 changes: 4 additions & 0 deletions Detection/yolo/models/yolo.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import torch
import torch_mlu
from torch_mlu.utils.model_transfer import transfer

# Ultralytics YOLOv5 🚀, AGPL-3.0 license
"""
YOLO-specific modules.
Expand Down
2 changes: 1 addition & 1 deletion Detection/yolo/run_eval.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

set -e

export CUDA_VISIBLE_DEVICES=0
export MLU_VISIBLE_DEVICES=0

# 读取环境变量,并将 MODEL 转换为小写
MODEL=${MODEL:-"yolov5s"}
Expand Down
2 changes: 1 addition & 1 deletion Detection/yolo/run_train.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

set -e

export CUDA_VISIBLE_DEVICES=0,1,2,3
export MLU_VISIBLE_DEVICES=0,1,2,3

# 读取环境变量,并将 MODEL 转换为小写
MODEL=${MODEL:-"yolov5s"}
Expand Down
4 changes: 4 additions & 0 deletions Detection/yolo/train.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import torch
import torch_mlu
from torch_mlu.utils.model_transfer import transfer

# Ultralytics YOLOv5 , AGPL-3.0 license
"""
Train a YOLOv5 model on a custom dataset. Models and datasets download automatically from the latest YOLOv5 release.
Expand Down
4 changes: 4 additions & 0 deletions Detection/yolo/utils/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import torch
import torch_mlu
from torch_mlu.utils.model_transfer import transfer

# Ultralytics YOLOv5 🚀, AGPL-3.0 license
"""utils/initialization."""

Expand Down
4 changes: 4 additions & 0 deletions Detection/yolo/utils/activations.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import torch
import torch_mlu
from torch_mlu.utils.model_transfer import transfer

# Ultralytics YOLOv5 🚀, AGPL-3.0 license
"""Activation functions."""

Expand Down
4 changes: 4 additions & 0 deletions Detection/yolo/utils/augmentations.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import torch
import torch_mlu
from torch_mlu.utils.model_transfer import transfer

# Ultralytics YOLOv5 🚀, AGPL-3.0 license
"""Image augmentation functions."""

Expand Down
4 changes: 4 additions & 0 deletions Detection/yolo/utils/autoanchor.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import torch
import torch_mlu
from torch_mlu.utils.model_transfer import transfer

# Ultralytics YOLOv5 🚀, AGPL-3.0 license
"""AutoAnchor utils."""

Expand Down
4 changes: 4 additions & 0 deletions Detection/yolo/utils/autobatch.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import torch
import torch_mlu
from torch_mlu.utils.model_transfer import transfer

# Ultralytics YOLOv5 🚀, AGPL-3.0 license
"""Auto-batch utils."""

Expand Down
4 changes: 4 additions & 0 deletions Detection/yolo/utils/aws/resume.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import torch
import torch_mlu
from torch_mlu.utils.model_transfer import transfer

# Ultralytics YOLOv5 🚀, AGPL-3.0 license
# Resume all interrupted trainings in yolov5/ dir including DDP trainings
# Usage: $ python utils/aws/resume.py
Expand Down
4 changes: 4 additions & 0 deletions Detection/yolo/utils/dataloaders.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import torch
import torch_mlu
from torch_mlu.utils.model_transfer import transfer

# Ultralytics YOLOv5 🚀, AGPL-3.0 license
"""Dataloaders and dataset utils."""

Expand Down
4 changes: 4 additions & 0 deletions Detection/yolo/utils/general.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import torch
import torch_mlu
from torch_mlu.utils.model_transfer import transfer

# Ultralytics YOLOv5 🚀, AGPL-3.0 license
"""General utils."""

Expand Down
4 changes: 4 additions & 0 deletions Detection/yolo/utils/loggers/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import torch
import torch_mlu
from torch_mlu.utils.model_transfer import transfer

# Ultralytics YOLOv5 🚀, AGPL-3.0 license
"""Logging utils."""

Expand Down
4 changes: 4 additions & 0 deletions Detection/yolo/utils/loggers/clearml/clearml_utils.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import torch
import torch_mlu
from torch_mlu.utils.model_transfer import transfer

# Ultralytics YOLOv5 🚀, AGPL-3.0 license
"""Main Logger class for ClearML experiment tracking."""

Expand Down
4 changes: 4 additions & 0 deletions Detection/yolo/utils/loggers/comet/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import torch
import torch_mlu
from torch_mlu.utils.model_transfer import transfer

# Ultralytics YOLOv5 🚀, AGPL-3.0 license

import glob
Expand Down
4 changes: 4 additions & 0 deletions Detection/yolo/utils/loggers/comet/hpo.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import torch
import torch_mlu
from torch_mlu.utils.model_transfer import transfer

# Ultralytics YOLOv5 🚀, AGPL-3.0 license

import argparse
Expand Down
4 changes: 4 additions & 0 deletions Detection/yolo/utils/loss.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import torch
import torch_mlu
from torch_mlu.utils.model_transfer import transfer

# Ultralytics YOLOv5 🚀, AGPL-3.0 license
"""Loss functions."""

Expand Down
4 changes: 4 additions & 0 deletions Detection/yolo/utils/metrics.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import torch
import torch_mlu
from torch_mlu.utils.model_transfer import transfer

# Ultralytics YOLOv5 🚀, AGPL-3.0 license
"""Model validation metrics."""

Expand Down
Loading