Skip to content

Commit

Permalink
add ignore file
Browse files Browse the repository at this point in the history
  • Loading branch information
yanxp committed Nov 16, 2018
1 parent 6af7050 commit 5a4fdd9
Show file tree
Hide file tree
Showing 7 changed files with 109 additions and 7 deletions.
72 changes: 72 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
data/*
*.pyc
*~

*.o
*.so

.ipynb_checkpoints
notebooks/*.pkl

/Outputs

# ------------------------------

.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

*~

# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*

# KDE directory preferences
.directory

# Linux trash folder which might appear on any partition or disk
.Trash-*

# .nfs files are created when an open file is removed but is still being accessed
.nfs*

*.pth

data/aliyun
data/logo
data/*.txt
aliyun
eval
csv
*.txt
*.csv
result
4 changes: 2 additions & 2 deletions data/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# from .voc import VOCDetection, AnnotationTransform, detection_collate, VOC_CLASSES
from .voc0712 import VOCDetection, AnnotationTransform, detection_collate, VOC_CLASSES, collate_minibatch
from .logo import LogoDetection, AnnotationTransform, LOGO_CLASSES
from .voc0712 import VOCDetection, AnnotationTransform, detection_collate, VOC_CLASSES
from .logo import LogoDetection, AnnotationTransform, LOGO_CLASSES, collate_minibatch
from .coco import COCODetection
from .data_augment import *
from .config import *
32 changes: 31 additions & 1 deletion data/logo.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@
import xml.etree.ElementTree as ET
import csv
from tqdm import tqdm
from .config import Logo_512
from torch.utils.data.dataloader import default_collate

fs = open('data/logo_name.txt','r')
fs = open('data/logo_name.txt','r')
LOGO_CLASSES = [ eval(name) for name in fs.readline().strip().split(',')]
fs.close()
# for making bounding boxes pretty
Expand Down Expand Up @@ -333,6 +335,34 @@ def show(self, index):



def collate_minibatch(list_of_blobs):
"""Custom collate fn for dealing with batches of images that have a different
number of associated object annotations (bounding boxes).
Arguments:
batch: (tuple) A tuple of tensor images and lists of annotations
Return:
A tuple containing:
1) (tensor) batch of images stacked on their 0 dim
2) (list of tensors) annotations for a given image are stacked on 0 dim
"""
Batch = {key: [] for key in list_of_blobs[0]}

list_of_target = [blobs.pop('target') for blobs in list_of_blobs]
# list_of_image = [blobs.pop('image') for blobs in list_of_blobs]
batch_size = Logo_512['numpergpu']

for i in range(0, len(list_of_blobs), batch_size):
# minibatch = {}
mini_list = list_of_blobs[i:(i + batch_size)]
# Pad image data
minibatch = default_collate(mini_list)
minibatch['target'] = list_of_target[i:(i + batch_size)]
for key in minibatch:
Batch[key].append(minibatch[key])

return Batch

## test
if __name__ == '__main__':
Expand Down
2 changes: 1 addition & 1 deletion data/logo_name.txt

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion srun_test_logo.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
srun --partition=SenseMediaA --mpi=pmi2 --gres=gpu:1 --job-name=Yolo --kill-on-bad-exit=1 python test_logo.py -d Logo -v RFB_E_vgg -s 512 --trained_model aliyunRFB_E_vgg_Logo_epoches_20.pth
srun --partition=SenseMediaA --mpi=pmi2 --gres=gpu:1 --job-name=Yolo --kill-on-bad-exit=1 python test_logo.py -d Logo -v RFB_E_vgg -s 512 --trained_model aliyunRFB_E_vgg_Logo_epoches_45.pth

2 changes: 1 addition & 1 deletion srun_train_logo.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
srun --partition=SenseMediaF --mpi=pmi2 --gres=gpu:8 --job-name=logo --kill-on-bad-exit=1 python train_logo_coco.py -d Logo -v RFB_E_vgg -s 512 -b 32 --ngpu 8 --save_folder aliyun --resume_net RFB512_E_34_4.pth
srun --partition=SenseMediaA --mpi=pmi2 --gres=gpu:8 --job-name=logo --kill-on-bad-exit=1 python train_logo_coco.py -d Logo -v RFB_E_vgg -s 512 -b 16 --ngpu 8 --save_folder 2000 --resume_net RFB512_E_34_4.pth
2 changes: 1 addition & 1 deletion train_logo_coco.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
num_classes = len(LOGO_CLASSES)


num_image_per_gpu = args.batch_size//args.ngpu
Logo_512['numpergpu'] = args.batch_size//args.ngpu

batch_size = args.batch_size
weight_decay = 0.0005
Expand Down

0 comments on commit 5a4fdd9

Please sign in to comment.