Skip to content

Commit

Permalink
metric scripts refactor.
Browse files Browse the repository at this point in the history
  • Loading branch information
youdonny committed Jan 16, 2019
1 parent 0133524 commit c57fc72
Show file tree
Hide file tree
Showing 45 changed files with 29 additions and 9,872 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,11 @@ python main.py --hypes hypes/pose/coco/op_coco_pose.json \

<div align="center">

<img src="val/examples/pose/coco/000000319721_vis.png" width="500px"/>
<img src="samples/pose/coco/000000319721_vis.png" width="500px"/>

<p> Example output of <b>VGG19-OpenPose</b></p>

<img src="val/examples/pose/coco/000000475191_vis.png" width="500px"/>
<img src="samples/pose/coco/000000475191_vis.png" width="500px"/>

<p> Example output of <b>VGG19-OpenPose</b></p>

Expand Down
2 changes: 1 addition & 1 deletion methods/cls/fc_classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from models.cls_model_manager import ClsModelManager
from utils.tools.average_meter import AverageMeter
from utils.tools.logger import Logger as Log
from val.scripts.cls.cls_running_score import ClsRunningScore
from metric.cls.cls_running_score import ClsRunningScore


cudnn.benchmark = True
Expand Down
2 changes: 1 addition & 1 deletion methods/det/faster_rcnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from utils.layers.det.fr_priorbox_layer import FRPriorBoxLayer
from utils.tools.average_meter import AverageMeter
from utils.tools.logger import Logger as Log
from val.scripts.det.det_running_score import DetRunningScore
from metric.det.det_running_score import DetRunningScore
from vis.visualizer.det_visualizer import DetVisualizer
from utils.helpers.dc_helper import DCHelper

Expand Down
2 changes: 1 addition & 1 deletion methods/det/single_shot_detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from utils.layers.det.ssd_target_generator import SSDTargetGenerator
from utils.tools.average_meter import AverageMeter
from utils.tools.logger import Logger as Log
from val.scripts.det.det_running_score import DetRunningScore
from metric.det.det_running_score import DetRunningScore
from vis.visualizer.det_visualizer import DetVisualizer


Expand Down
2 changes: 1 addition & 1 deletion methods/det/yolov3.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from utils.layers.det.yolo_target_generator import YOLOTargetGenerator
from utils.tools.average_meter import AverageMeter
from utils.tools.logger import Logger as Log
from val.scripts.det.det_running_score import DetRunningScore
from metric.det.det_running_score import DetRunningScore
from vis.visualizer.det_visualizer import DetVisualizer


Expand Down
2 changes: 1 addition & 1 deletion methods/seg/fcn_segmentor.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from models.seg_model_manager import SegModelManager
from utils.tools.average_meter import AverageMeter
from utils.tools.logger import Logger as Log
from val.scripts.seg.seg_running_score import SegRunningScore
from metric.seg.seg_running_score import SegRunningScore
from vis.visualizer.seg_visualizer import SegVisualizer


Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env python
#-*- coding:utf-8 -*-
# -*- coding:utf-8 -*-
# Author: Donny You(youansheng@gmail.com)
# Evaluation of coco.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env python
#-*- coding:utf-8 -*-
# -*- coding:utf-8 -*-
# Author: Donny You(youansheng@gmail.com)
# Object Detection running score.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env python
#-*- coding:utf-8 -*-
# -*- coding:utf-8 -*-
# Author: Donny You(youansheng@gmail.com)
# Evaluation of coco.

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import numpy as np
import argparse

from val.scripts.seg.seg_running_score import SegRunningScore
from metric.seg.seg_running_score import SegRunningScore
from utils.helpers.image_helper import ImageHelper
from utils.tools.logger import Logger as Log
from utils.tools.configer import Configer
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@

# Cityscapes modules
try:
from annotation import Annotation
from labels import labels, name2label, id2label, trainId2label, category2labels
from metric.seg.cityscape.helpers.annotation import Annotation
from metric.seg.cityscape.helpers.labels import labels, name2label, id2label, trainId2label, category2labels
except:
print("Failed to find all Cityscapes modules")
sys.exit(-1)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions metric/seg/cityscape/make.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
cd ../../../
python metric/seg/cityscape/setup.py build_ext --inplace

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/python
#
# Enable cython support for eval scripts
# Enable cython support for eval metric
# Run as
# setup.py build_ext --inplace
#
Expand All @@ -18,5 +18,5 @@
os.environ["CC"] = "g++"
os.environ["CXX"] = "g++"

setup(ext_modules = cythonize("val/scripts/seg/cityscape/evaluation/addToConfusionMatrix.pyx"),
setup(ext_modules = cythonize("metric/seg/cityscape/evaluation/addToConfusionMatrix.pyx"),
include_dirs=[numpy.get_include()])
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env python
#-*- coding:utf-8 -*-
# -*- coding:utf-8 -*-
# Author: Donny You(youansheng@gmail.com)
# Evaluation of cityscape.

Expand All @@ -19,7 +19,7 @@
izip = zip

# Cityscapes imports
from val.scripts.seg.cityscape.evaluation.csHelpers import *
from metric.seg.cityscape.evaluation.csHelpers import *

# C Support
# Enable the cython support for faster evaluation, this is necessary for speeding up your model results
Expand All @@ -28,7 +28,7 @@
# Check if C-Support is available for better performance
if CSUPPORT:
try:
import val.scripts.seg.cityscape.evaluation.addToConfusionMatrix as addToConfusionMatrix
import metric.seg.cityscape.evaluation.addToConfusionMatrix as addToConfusionMatrix
except:
CSUPPORT = False

Expand All @@ -48,9 +48,9 @@ def __init__(self, data_path=None, out_path=None, predict_path=None):
raise ValueError("CITYSCAPES_EXPORT_DIR {} is not a directory".format(export_dir))
self.exportFile = "{}/resultPixelLevelSemanticLabeling.json".format(export_dir)
else:
self.exportFile = os.path.join(out_path, "evaluationResults", "resultPixelLevelSemanticLabeling.json")
self.exportFile = os.path.join(out_path, "../evaluationResults", "resultPixelLevelSemanticLabeling.json")
# Parameters that should be modified by user
self.groundTruthSearch = os.path.join( self.cityscapesPath, "*", "*_gtFine_labelIds.png" )
self.groundTruthSearch = os.path.join( self.cityscapesPath, "*.png" )

# Remaining params
self.evalInstLevelScore = True
Expand Down Expand Up @@ -670,7 +670,7 @@ def evaluate(self, pred_dir=None, gt_dir=None):
pred_path = pred_dir
data_path = gt_dir
print("evaluate the result...")
args = CArgs(data_path=data_path, out_path=data_path, predict_path=pred_path)
args = CArgs(data_path=data_path, out_path=pred_path, predict_path=pred_path)
ob = EvalPixel(args)
ob.run()

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# Author: Donny You(youansheng@gmail.com)


import os
import json
import argparse
Expand Down
File renamed without changes.
Binary file removed val/examples/pose/coco/000000319721_vis.png
Binary file not shown.
Binary file removed val/examples/pose/coco/000000475191_vis.png
Binary file not shown.
Binary file removed val/samples/pose/coco/000000319721.jpg
Binary file not shown.
Binary file removed val/samples/pose/coco/000000475191.jpg
Binary file not shown.
Binary file removed val/samples/pose/coco/ski.jpg
Binary file not shown.
Loading

0 comments on commit c57fc72

Please sign in to comment.