tensorflow / tensorflow/models

Extending the Pascal Model with more classes

Open
#8,905 0 comments 0 reactions 3 assignees View on GitHub

@aquariusjay is already working on this.

Since Jul 20, 2020.

models:research type:bug
Dominant language
Python
Stars
77.7k
Forks
44.8k
PR merge metrics
No merged PRs in 30d

Description

Prerequisites

Please answer the following questions for yourself before submitting an issue.

  • [ x ] I am using the latest TensorFlow Model Garden release and TensorFlow 2.
  • [ x ] I am reporting the issue to the correct repository. (Model Garden official or research directory)
  • [ x ] I checked to make sure that this issue has not already been filed.

1. The entire URL of the file you are using

https://github.com/tensorflow/models/tree/master/research/...

2. Describe the bug

I am trying to take a current dataset and add onto it. For example, take Pascal and add in a "giraffe" class for instance. I was able to get some new images segmented and a model trained to some degree of success that included my new class:

BaseModel+Class+LLCLO

It got the outline of the dogs correct but it looks like it has a few problems: the labels are incorrect and the background was completely different than what original pascal dataset model looked like for this image:

BaseModel

I'm wondering if there is something i did obviously wrong here. The modifications I made to the code are mostly outlined in this issue: https://github.com/tensorflow/models/issues/3730.

  1. num_classes=22
  2. exclude_list = ['global_step', 'logits']
  3. "You want to re-use ALL the trained weights EXCEPT the logits (since the num_classes may be different): set initialize_last_layer = False and last_layers_contain_logits_only = True.".

I even did an attempt with keeping pascals default class value of 21 and only following steps (2) and (3) but I got a similar result:

image

vs

correct base:

BaseModelFrisbee

My goal is to be able to keep the pascal model at it's current accuracy and add more classes into it. I was hoping i could accomplish this based off of "You want to re-use ALL the trained weights EXCEPT the logits (since the num_classes may be different) ..." but I am struggling hard on how to actually make this work :(. I probably have a fundamental misunderstanding on how to do this or if this can even be done.

Here are my train and export methods if that matters at all:

python "D:\DeepLab\models-master\research\deeplab\train.py" --logtostderr --train_split="trainval" --model_variant="xception_65" --atrous_rates=6 --atrous_rates=12 --atrous_rates=18 --output_stride=16 --decoder_output_stride=4 --train_crop_size="513,513" --train_batch_size=2 --dataset="pascal_voc_seg" --training_number_of_steps=20 --fine_tune_batch_norm=true --tf_initial_checkpoint="D:\DeepLab\models-master\research\deeplab\datasets\pascal_voc_seg\init_models\deeplabv3_pascal_train_aug\model.ckpt" --train_logdir="D:\DeepLab\models-master\research\deeplab\datasets\pascal_voc_seg\exp\train_on_trainval_set\train" --dataset_dir="D:\DeepLab\models-master\research\deeplab\datasets\pascal_voc_seg\tfrecord"

python "D:\DeepLab\models-master\research\deeplab\export_model.py" --logtostderr --checkpoint_path="D:\DeepLab\models-master\research\deeplab\datasets\pascal_voc_seg\exp\train_on_trainval_set\train\model.ckpt-20" --export_path="D:\DeepLab\models-master\research\deeplab\datasets\pascal_voc_seg\exp\train_on_trainval_set\export\frozen_inference_graph.pb" --model_variant="xception_65" --atrous_rates=6 --atrous_rates=12 --atrous_rates=18 --output_stride=16 --decoder_output_stride=4 --num_classes=21 --crop_size=513 --crop_size=513 --inference_scales=1.0

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.