Open nhk9680 opened 5 years ago
@nhk9680 결론이 제공자측의 잘못으로 학습할수 없다 라는게 결론인가요?
@unizard 아니요, 누락된 파일은 Warning으로만 뜨는 걸 보면 추후 진행에는 문제가 없는 듯 합니다. 아직 진행중이라 결론은 정리해서 작성할 예정입니다.
우선 drive에 업로드 된 영상에 문제가 있는지 재생했지만 정상적으로 나옵니다.
colab에서만 이러한 증상이 생기는 건지 로컬에서도 뽑아봤지만, 정상적으로 나옵니다.
imshow()
에 문제가 있었다면 다운로드한 이미지는 정상적으로 나와야하지만 그렇지 않습니다.
하나만 그런것도 아니고 모든 프레임이 저렇게 나와서 구글링 중입니다.
@nhk9680 R 채널이 소실되었다는게 어떤의미죠? 지금 콘이 주황색이 아니여서 R채널 소실이라고 보는거죠? 저거 RGB 채널이 BGR로 저장되어 있어서 그래요. 뒤집어서 출력해보세요.
@nhk9680 R 채널이 소실되었다는게 어떤의미죠? 지금 콘이 주황색이 아니여서 R채널 소실이라고 보는거죠? 저거 RGB 채널이 BGR로 저장되어 있어서 그래요. 뒤집어서 출력해보세요.
감사합니다! 원래대로 잘 뽑힙니다.
image=cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
같은 코드, 같은 소스인데 colab에서만 반전되는게 신기하네요..
@nhk9680 코랩에서만 반전이 된다는건 좀 이상한게... 저 현상은 opencv를 사용하면 항상생기는 현상이예요. Opencv의 칼라영상 로더의 채널저장법이 기타 라이브러리들과 차이가 있어요. 아마 로컬머신에서 저런 문제가 발생하지 않은것 처럼 보였다면 분명 시각화하는 부분이 opencv가 아닌 matlabplot 과 같이 다른 라이브러리를 사용하고 있었을겁니다.
# SSD with Mobilenet v2 configuration for MSCOCO Dataset.
# Users should configure the fine_tune_checkpoint field in the train config as
# well as the label_map_path and input_path fields in the train_input_reader and
# eval_input_reader. Search for "PATH_TO_BE_CONFIGURED" to find the fields that
# should be configured.
model {
ssd {
num_classes: 3
box_coder {
faster_rcnn_box_coder {
y_scale: 10.0
x_scale: 10.0
height_scale: 5.0
width_scale: 5.0
}
}
matcher {
argmax_matcher {
matched_threshold: 0.5
unmatched_threshold: 0.5
ignore_thresholds: false
negatives_lower_than_unmatched: true
force_match_for_each_row: true
}
}
similarity_calculator {
iou_similarity {
}
}
anchor_generator {
ssd_anchor_generator {
num_layers: 6
min_scale: 0.2
max_scale: 0.95
aspect_ratios: 1.0
aspect_ratios: 2.0
aspect_ratios: 0.5
aspect_ratios: 3.0
aspect_ratios: 0.3333
}
}
image_resizer {
fixed_shape_resizer {
height: 300
width: 300
}
}
box_predictor {
convolutional_box_predictor {
min_depth: 0
max_depth: 0
num_layers_before_predictor: 0
use_dropout: false
dropout_keep_probability: 0.8
kernel_size: 1
box_code_size: 4
apply_sigmoid_to_scores: false
conv_hyperparams {
activation: RELU_6,
regularizer {
l2_regularizer {
weight: 0.00004
}
}
initializer {
truncated_normal_initializer {
stddev: 0.03
mean: 0.0
}
}
batch_norm {
train: true,
scale: true,
center: true,
decay: 0.9997,
epsilon: 0.001,
}
}
}
}
feature_extractor {
type: 'ssd_mobilenet_v2'
min_depth: 16
depth_multiplier: 1.0
conv_hyperparams {
activation: RELU_6,
regularizer {
l2_regularizer {
weight: 0.00004
}
}
initializer {
truncated_normal_initializer {
stddev: 0.03
mean: 0.0
}
}
batch_norm {
train: true,
scale: true,
center: true,
decay: 0.9997,
epsilon: 0.001,
}
}
}
loss {
classification_loss {
weighted_sigmoid {
}
}
localization_loss {
weighted_smooth_l1 {
}
}
hard_example_miner {
num_hard_examples: 3000
iou_threshold: 0.99
loss_type: CLASSIFICATION
max_negatives_per_positive: 3
min_negatives_per_image: 3
}
classification_weight: 1.0
localization_weight: 1.0
}
normalize_loss_by_num_matches: true
post_processing {
batch_non_max_suppression {
score_threshold: 1e-8
iou_threshold: 0.6
max_detections_per_class: 100
max_total_detections: 100
}
score_converter: SIGMOID
}
}
}
train_config: {
batch_size: 12
optimizer {
rms_prop_optimizer: {
learning_rate: {
exponential_decay_learning_rate {
initial_learning_rate: 0.004
decay_steps: 800720
decay_factor: 0.95
}
}
momentum_optimizer_value: 0.9
decay: 0.9
epsilon: 1.0
}
}
fine_tune_checkpoint: "/content/models/research/pretrained_model/model.ckpt"
fine_tune_checkpoint_type: "detection"
# Note: The below line limits the training process to 200K steps, which we
# empirically found to be sufficient enough to train the pets dataset. This
# effectively bypasses the learning rate schedule (the learning rate will
# never decay). Remove the below line to train indefinitely.
num_steps: 1000
data_augmentation_options {
random_horizontal_flip {
}
}
data_augmentation_options {
ssd_random_crop {
}
}
}
train_input_reader: {
tf_record_input_reader {
input_path: "/content/object_detection_demo/data/annotations/train.record"
}
label_map_path: "/content/object_detection_demo/data/annotations/label_map.pbtxt"
}
eval_config: {
num_examples: 8000
# Note: The below line limits the evaluation process to 10 evaluations.
# Remove the below line to evaluate indefinitely.
max_evals: 10
}
eval_input_reader: {
tf_record_input_reader {
input_path: "/content/object_detection_demo/data/annotations/test.record"
}
label_map_path: "/content/object_detection_demo/data/annotations/label_map.pbtxt"
shuffle: false
num_readers: 1
}
저장용
각종 파일 format
확장자명 | 용도 |
---|---|
pb | Binary Graph |
pbtxt | Text Graph |
ckpt | 학습 변수 체크포인트 |
record | Binary 학습 데이터 |
freeze_graph : ckpt -> pb
코드
Object detection Tensorflow API
detection boxes 값의 의미
(left, right, top, bottom) = (xmin * im_width, xmax * im_width, ymin * im_height, ymax * im_height)
정규화된 좌표, 즉 상대적인 좌표를 제공합니다.
matplotlib 사용시 loop로 인한 memory leack (overflow) 문제
.clf()
,.close()
,import gc; gc.collect()
등을 사용하면 된다고 합니다.다음 계획
Dataset이나 Video를 로드하여 demo를 출력해볼 예정
colab으로 학습해보기
다음 계획
rkdogo08 님의 dataset 리뷰 보고 적용하기
NotfoundError : No such file or directory
!cd models/research
안하고!python models/research/object_detection/~
했을 때:보다시피 실행했던 기본 경로가 /content 이다 보니,
object_detection
폴더를 찾지 못한다.해결 시도
ln -s /models/research/object_detection object_detection
결과
이는 현재 제공자 측에서 파일이 누락된 상태에서 발생하는 warning입니다.
그러나 이는 예제파일일 뿐, custom dataset으로 학습 시에는 문제되지 않습니다.
디렉토리에 결과를 보면
반복적으로 생성된 파일들이 tfrecord임을 추정할 수 있지만,
!ls *.record
를 실행하면라고 에러를 뱉어냅니다.
!ls pet_faces_train.record-00000-of-00010.record
해도 결과는마찬가지입니다.