Pretrained model for universenet in Nightowls dataset
rsj007 opened this issue · 9 comments
Hi,shinya7y!
Is it the pretrained model for universenet in Nightowls dataset available?I can't find the file "load_from = '../data/checkpoints/universenet50_fp16_8x2_lr0001_mstrain_640_1280_7e_waymo_open_20200526_080330/epoch_7_for_nightowls.pth'" in your project.
Thanks a lot!
Please follow this Notes, because the file was trained on Waymo Open (and converted using this script).
Sorry. I have received Registration Confirmed email from Waymo dataset.
Please give me a download link of "universenet50_fp16_8x2_lr0001_mstrain_640_1280_7e_waymo_open_20200526_080330/epoch_7_for_nightowls.pth". Or you can contact with me by email---736720216@qq.com.
Thanks!
I will paste some scripts for testing. Please edit them on your own if they are outdated.
Splitting nightowls_test_imageids.json to 10 shards.
import json
json_path = '../data/nightowls/annotations/nightowls_test_imageids.json' # noqa
output_path_f = '../data/nightowls/annotations/nightowls_test_imageids_shard{:02d}.json' # noqa
with open(json_path) as f:
all_info = json.load(f)
print(all_info.keys())
print(all_info['annotations'])
print(all_info['categories'])
print(all_info['poses'])
num_images = len(all_info['images'])
print('num_images:', num_images)
images_list = [[], [], [], [], [], [], [], [], [], []]
for image_idx, image in enumerate(all_info['images']):
shard_index = int(image_idx * 10 / num_images)
images_list[shard_index].append(image)
for i in range(10):
print(len(images_list[i]))
shard_info = {}
shard_info['images'] = images_list[i]
shard_info['categories'] = all_info['categories']
shard_info['poses'] = all_info['poses']
output_path = output_path_f.format(i)
with open(output_path, 'w') as f:
json.dump(shard_info, f, indent=None)
Inference by mmdetection.
for SHARD_ID in $(seq -w 00 09); do
echo "shard${SHARD_ID}"
JOB_ID=universenet50_fp16_4x4_lr0001_mstrain_640_1280_from_waymo_7e_nightowls_test
LOG_DIR=${HOME}/logs/nightowls/universenet50_fp16_4x4_lr0001_mstrain_640_1280_from_waymo_7e_nightowls_20200608_093807
./tools/dist_test.sh \
configs/nightowls/${JOB_ID}.py \
${LOG_DIR}/epoch_2.pth \
4 \
--cfg-options \
"data.test.ann_file=data/nightowls/annotations/nightowls_test_imageids_shard${SHARD_ID}.json" \
"data.test.img_prefix=data/nightowls/nightowls_test/" \
--options "jsonfile_prefix=${LOG_DIR}/results_test_800_960_flip_epoch_2_shard${SHARD_ID}" \
--format-only
done
Concatenating detections and extracting pedestrian category for submission.
import json
def dump_rounded_json(obj_to_dump, f, rounding=7):
json.dump(
json.loads(
json.dumps(obj_to_dump),
parse_float=lambda x: round(float(x), rounding)),
f,
indent=None,
sort_keys=False)
json_path_f = '../logs/nightowls/universenet50_fp16_4x4_lr0001_mstrain_640_1280_from_waymo_7e_nightowls_20200608_093807/results_test_800_960_flip_epoch_2_shard{:02d}.bbox.json' # noqa
output_path = '../logs/nightowls/universenet50_fp16_4x4_lr0001_mstrain_640_1280_from_waymo_7e_nightowls_20200608_093807/results_test_800_960_flip_epoch_2_concat_s.bbox.json' # noqa
output_path_ped = '../logs/nightowls/universenet50_fp16_4x4_lr0001_mstrain_640_1280_from_waymo_7e_nightowls_20200608_093807/results_test_800_960_flip_epoch_2_concat_s_ped.bbox.json' # noqa
score_thresh_ped = 0.03
dets = []
for shard_id in range(10):
with open(json_path_f.format(shard_id)) as f:
shard_dets = json.load(f)
print(len(shard_dets))
dets.extend(shard_dets)
print("dets", len(dets))
dets_ped = []
dets_all = []
for det in dets:
if det["category_id"] == 1:
if det["score"] >= score_thresh_ped:
dets_ped.append(det)
dets_all.append(det)
else:
dets_all.append(det)
print("dets_ped", len(dets_ped))
print("dets_all", len(dets_all))
with open(output_path, mode='w') as f:
dump_rounded_json(dets_all, f)
with open(output_path_ped, mode='w') as f:
dump_rounded_json(dets_ped, f)
Hi,shinya7y!
I have two questions.
1.Why do you spilt the testing into 10 shards? Can I test as a whole?
2.Besides, which code language is about the “for loop” you mentioned MMdetection inference? Whether I will run the code for ten times?
Thanks
- The sharding is mainly for avoiding CPU out of memory. You can first try to test as a whole.
- bash
I can't support more details since these scripts are not related to the main code.
No. I cannot support any more.