diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..59e4116 --- /dev/null +++ b/.gitignore @@ -0,0 +1,15 @@ +output +**/__pycache__ +build +.idea +**egg-info +ic15_evaluate/ch4_gt +datasets +Res50_imagenet.pth +maskrcnn_benchmark/*.so +maskrcnn_benchmark.egg-info/SOURCES.txt +ic15_evaluate/mb_ch4_results +ic15_evaluate/all_detcors.txt +ic15_evaluate/bo.json +ic15_evaluate/evaluation_results.txt +ic15_evaluate/rrc_evaluation_funcs.pyc diff --git a/README.md b/README.md index 97d08fc..8b20e49 100644 --- a/README.md +++ b/README.md @@ -19,19 +19,20 @@ This is a pytorch-based implementation for paper [ContourNet](https://arxiv.org/ ``` ## Requirements -We recommend you to use Anaconda [BaiduYun](https://pan.baidu.com/s/1_J9INU-UpiT43qormibAuw)(passward:1y3v) or [Drive](https://drive.google.com/file/d/1H64lTpR3xzlSRfUxfZa4dOhAYZJcO7RU/view?usp=sharing) to manage your libraries. +We recommend you to use Anaconda [BaiduYun Link](https://pan.baidu.com/s/1_J9INU-UpiT43qormibAuw)(passward:1y3v) or [Google Drive](https://drive.google.com/file/d/1H64lTpR3xzlSRfUxfZa4dOhAYZJcO7RU/view?usp=sharing) to manage your libraries. + ### Step-by-step install ```bash - conda create --name ContourNet + conda create --name ContourNet python=3.6 conda activate ContourNet conda install ipython pip install ninja yacs cython matplotlib tqdm scipy shapely networkx pandas - conda install pytorch=1.0 torchvision=0.2 cudatoolkit=9.0 -c pytorch + conda install pytorch=1.0 torchvision=0.2 cudatoolkit=10.0 -c pytorch conda install -c menpo opencv - export INSTALL_DIR=$PWDcd $INSTALL_DIR + export INSTALL_DIR=$PWD git clone https://github.com/cocodataset/cocoapi.git cd cocoapi/PythonAPI python setup.py build_ext install @@ -55,7 +56,8 @@ We use only official training images to train our model. ## Experiment on IC15 dataset ### Data preparing #### step 1 - Prepare data follow COCO format or you can download our IC15dataset [BAIDU](https://pan.baidu.com/s/1GbF0PnWDKw3qn2o2XgpB7Q) (passward:ect5) or [Geogle Drive](https://drive.google.com/file/d/1ZWRQWJwhydoCsqdNlX80y94cKQedUywO/view?usp=sharing), and unzip it in + Prepare data follow COCO format or you can download our [IC15dataset-BAIDU](https://pan.baidu.com/s/1GbF0PnWDKw3qn2o2XgpB7Q) (passward:ect5) or [Google Drive](https://drive.google.com/file/d/1ZWRQWJwhydoCsqdNlX80y94cKQedUywO/view?usp=sharing), and unzip it in + ```bash datasets/. ``` diff --git a/ic15_evaluate/eval_ic15.py b/ic15_evaluate/eval_ic15.py index 9bbf815..683ff42 100644 --- a/ic15_evaluate/eval_ic15.py +++ b/ic15_evaluate/eval_ic15.py @@ -30,15 +30,15 @@ ########## second step: evaluate results dirn = "mb_ch4_results" eval_dir = "./" -# lsc = [0.51+i*1.0/100 for i in range(30)] -lsc = [0.65] +lsc = list(range(20,90,1)) +# lsc = [0.65] -f = open("evaluation_resutls.txt",'w') +f = open("evaluation_results.txt",'w') fres = open('all_detcors.txt', 'r').readlines() for isc in lsc: - print 'Evaluating cf threshold {} ...'.format(str(isc)), + print('Evaluating cf threshold 0.{}:'.format(str(isc))) sys.stdout.flush() if os.path.exists("mb_ch4.zip"): @@ -56,7 +56,7 @@ outName = os.path.join(dirn, filename) with open(outName, 'a') as fout: score = s[1].split(',')[-1].strip() - if float(score) -s= [-o= -p=]' %sys.argv[0]) @@ -303,7 +302,7 @@ def main_evaluation(p,default_evaluation_params_fn,validate_data_fn,evaluate_met evalData = evaluate_method_fn(p['g'], p['s'], evalParams) resDict.update(evalData) - except Exception, e: + except Exception as e: resDict['Message']= str(e) resDict['calculated']=False @@ -355,8 +354,8 @@ def main_validation(default_evaluation_params_fn,validate_data_fn): evalParams.update( p['p'] if isinstance(p['p'], dict) else json.loads(p['p'][1:-1]) ) validate_data_fn(p['g'], p['s'], evalParams) - print 'SUCCESS' + print('SUCCESS') sys.exit(0) except Exception as e: - print str(e) + print(str(e)) sys.exit(101) \ No newline at end of file diff --git a/ic15_evaluate/script.py b/ic15_evaluate/script.py index 67840b0..ee8ee4d 100644 --- a/ic15_evaluate/script.py +++ b/ic15_evaluate/script.py @@ -1,4 +1,4 @@ -#!/usr/bin/env pytho +#!/usr/bin/env python # -*- coding: utf-8 -*- from collections import namedtuple import rrc_evaluation_funcs diff --git a/maskrcnn_benchmark/data/datasets/evaluation/word/word_eval.py b/maskrcnn_benchmark/data/datasets/evaluation/word/word_eval.py index d47ef0f..34d1598 100644 --- a/maskrcnn_benchmark/data/datasets/evaluation/word/word_eval.py +++ b/maskrcnn_benchmark/data/datasets/evaluation/word/word_eval.py @@ -347,7 +347,7 @@ def boundary_to_mask_ctw(bo_x,bo_y, name, num, image_name_name,p_temp_box): def mask_to_roRect(mask, img_shape): ## convert mask into rotated rect e = mask[0, :, :] - _, countours, hier = cv2.findContours(e.clone().numpy(), cv2.RETR_CCOMP, cv2.CHAIN_APPROX_NONE) # Aarlog + countours, hier = cv2.findContours(e.clone().numpy(), cv2.RETR_CCOMP, cv2.CHAIN_APPROX_NONE) # Aarlog if len(countours) == 0: return np.zeros((1, 8)) t_c = countours[0].copy() diff --git a/requirements.txt b/requirements.txt index a67b697..bf20d46 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,3 +3,7 @@ yacs cython matplotlib tqdm +scipy +shapely +networkx +pandas \ No newline at end of file