Skip to content

Commit aff8afc

Browse files
committed
fix: script for miou calculation
1 parent 0ae395c commit aff8afc

File tree

7 files changed

+11
-4
lines changed

7 files changed

+11
-4
lines changed

compressai_vision/codecs/sic_sfu2022.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
import torch
3939
import torch.nn as nn
4040
import torch.nn.functional as F
41+
4142
from torch.hub import load_state_dict_from_url
4243

4344
from compressai.ans import BufferedRansEncoder, RansDecoder

compressai_vision/datasets/image.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
from typing import Dict, List
3838

3939
import numpy as np
40+
4041
from detectron2.data import DatasetCatalog, MetadataCatalog
4142
from detectron2.data.common import DatasetFromList, MapDataset
4243
from detectron2.data.dataset_mapper import DatasetMapper

compressai_vision/model_wrappers/detectron2.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2828

2929
import re
30+
3031
from enum import Enum
3132
from pathlib import Path
3233
from typing import Dict, List
@@ -81,7 +82,6 @@ def __init__(self, *args, **kwargs) -> None:
8182
self.activation = activation
8283

8384
def set_attributes(self, module):
84-
8585
if hasattr(module, "norm"):
8686
self.norm = module.norm
8787

@@ -125,7 +125,6 @@ def __init__(self, *args, **kwargs) -> None:
125125
self.activation = activation
126126

127127
def set_attributes(self, module):
128-
129128
if hasattr(module, "norm"):
130129
self.norm = module.norm
131130

compressai_vision/model_wrappers/intconv2d.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232

3333
import numpy as np
3434
import torch
35+
3536
from torch.nn import functional as F
3637

3738

compressai_vision/model_wrappers/jde_lowlevel.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929

3030
import torch
3131
import torch.nn as nn
32+
3233
from jde.models import EmptyLayer, Upsample, YOLOLayer
3334

3435
from .intconv2d import IntConv2d

compressai_vision/pipelines/remote_inference/video_remote_inference.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,9 @@ def __call__(
198198
) # Assuming one qp will be used
199199

200200
if not isinstance(res["bitstream"], dict):
201-
out_res["bytes"] = Path(res["bitstream"]).stat().st_size / len(dataloader)
201+
out_res["bytes"] = Path(res["bitstream"]).stat().st_size / len(
202+
dataloader
203+
)
202204
else:
203205
assert len(res["bytes"]) == len(dataloader)
204206
out_res["bytes"] = res["bytes"][e]

scripts/metrics/compute_overall_miou.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
3434
3535
"""
36+
3637
from __future__ import annotations
3738

3839
import argparse
@@ -43,6 +44,8 @@
4344

4445
from compressai_vision.evaluators.evaluators import BaseEvaluator
4546

47+
from .compute_overall_mota import compute_overall_mota
48+
4649
CLASSES = ["PANDAM1", "PANDAM2", "PANDAM2"]
4750

4851
SEQS_BY_CLASS = {
@@ -92,7 +95,6 @@
9295

9396

9497
def compute_overall_mIoU(class_name, items):
95-
9698
miou_acc = 0.0
9799
for item in items:
98100
with open(item["eval_info"], "r") as f:

0 commit comments

Comments
 (0)