mmdet version, get_classes, palette
parent
b4d86bcf92
commit
deeb4ac7ff
19
install.py
19
install.py
|
|
@ -15,9 +15,16 @@ def check_mmcv() -> bool:
|
|||
|
||||
import mmcv
|
||||
|
||||
if version.parse(mmcv.__version__) >= version.parse("2.0.0"):
|
||||
return True
|
||||
return False
|
||||
return version.parse(mmcv.__version__) >= version.parse("2.0.0rc1")
|
||||
|
||||
|
||||
def check_mmdet() -> bool:
|
||||
if not is_installed("mmdet"):
|
||||
return False
|
||||
|
||||
import mmdet
|
||||
|
||||
return version.parse(mmdet.__version__) >= version.parse("3.0.0rc0")
|
||||
|
||||
|
||||
def install():
|
||||
|
|
@ -33,11 +40,11 @@ def install():
|
|||
print("Installing pycocotools...")
|
||||
run("pip install aiartchan-pycocotools")
|
||||
|
||||
if not is_installed("mmdet"):
|
||||
if not check_mmdet():
|
||||
print("Installing mmdet...")
|
||||
run("pip install mmdet")
|
||||
run("pip install mmdet==3.0.0rc6")
|
||||
|
||||
if not is_installed("openmim"):
|
||||
if not is_installed("mim"):
|
||||
print("Installing openmim...")
|
||||
run("pip install openmim")
|
||||
|
||||
|
|
|
|||
|
|
@ -794,7 +794,7 @@ def create_segmasks(results):
|
|||
|
||||
import mmcv
|
||||
from mmdet.apis import inference_detector, init_detector
|
||||
from mmdet.core import get_classes
|
||||
from mmdet.evaluation import get_classes
|
||||
|
||||
|
||||
def get_device():
|
||||
|
|
@ -816,7 +816,9 @@ def inference_mmdet_segm(image, modelname, conf_thres, label):
|
|||
model_checkpoint = modelpath(modelname)
|
||||
model_config = os.path.splitext(model_checkpoint)[0] + ".py"
|
||||
model_device = get_device()
|
||||
model = init_detector(model_config, model_checkpoint, device=model_device)
|
||||
model = init_detector(
|
||||
model_config, model_checkpoint, palette="random", device=model_device
|
||||
)
|
||||
mmdet_results = inference_detector(model, np.array(image))
|
||||
bbox_results, segm_results = mmdet_results
|
||||
dataset = modeldataset(modelname)
|
||||
|
|
@ -844,7 +846,9 @@ def inference_mmdet_bbox(image, modelname, conf_thres, label):
|
|||
model_checkpoint = modelpath(modelname)
|
||||
model_config = os.path.splitext(model_checkpoint)[0] + ".py"
|
||||
model_device = get_device()
|
||||
model = init_detector(model_config, model_checkpoint, device=model_device)
|
||||
model = init_detector(
|
||||
model_config, model_checkpoint, palette="random", device=model_device
|
||||
)
|
||||
results = inference_detector(model, np.array(image))
|
||||
cv2_image = np.array(image)
|
||||
cv2_image = cv2_image[:, :, ::-1].copy()
|
||||
|
|
|
|||
Loading…
Reference in New Issue