Comments (4)
Exactly. Each pixel in the annotation image is the label_id.
Each line in the trian_id.txt represents the img_name prefix of each image in the training set.
If you want to train on a customize dataset, you need to also corresponding modifications for the dataset.py based on your own need (usually minor modification).
from self-correction-human-parsing.
can you explain what should i do for train step by step?
first run witch file? and then?
thanks
from self-correction-human-parsing.
@SajjadAemmi please follow the data structure of LIP (Look into people) dataset.
Simply put you need a train_images (original images) folder with train_id.txt accordingly mapping with the image's name. The same applies to validation_images.
However, for the train/Val segmentations there is a little bit trickier to get it. You have to have the labels (ground truth) of your definitions and then convert it to the class images before mapping its name to val_id.txt.
The default LIP Val/train segmentations have 19 classes which mean each class represents a specific object.
Suppose your segmentation is the bellow image:
There are 11 classes in that color image, each one represents for an object in the picture (head, top, bottom .. etc. You can define your own objects/classes.)
Each class has a different color, for example, the hair has the value (35, 125, 200)
in BGR. What you need to do is convert that specific color to the class.
Here is the snipped code that helps you convert the color to class:
`
COLOR_PICKER_THRESHOLD = 20
def convert_color_image_to_class_image(img: np.ndarray, LABEL_COLORS: np.array) -> np.ndarray:
'''Args:
img: Color image (np.adarray)
Returns: Classes image
'''
assert img is not None, "This is the empty image!"
class_image = np.zeros((img.shape[0], img.shape[1], len(LABEL_COLORS)), np.uint8)
class_image = np.zeros((img.shape[0], img.shape[1], len(LABEL_COLORS)), np.uint8)
for i in range(1, len(LABEL_COLORS)):
single_part = cv2.inRange(img, LABEL_COLORS[i] - COLOR_PICKER_THRESHOLD,
LABEL_COLORS[i] + COLOR_PICKER_THRESHOLD)
class_image[:, :, i] = single_part
class_image = np.argmax(class_image, axis=2)
class_image = np.uint8(class_image)
return class_image
`
you define the variable 'LABEL_COLORS' like below:
`
CLASS_COLOR = {
"hair": (0, 0, 0),
"other classes": (x, y, y)
}
LABEL_COLORS = np.array([CLASS_COLOR['hair'],
CLASS_COLOR['other classes"']],
dtype=np.float32)
`
Now the hair is the first class of the image which has the value of 0, then you feed both original image and segmentation image to the network with num_classes=11 and wait for the great and glorious work of @PeikeLi!
Thank @PeikeLi for make the training code available.
p/s: there is a minor issue in the training code that I have shared with @PeikeLi here: #17, go and fix it your self.
regards,
from self-correction-human-parsing.
@PeikeLi and @VyBui
thanks
from self-correction-human-parsing.
Related Issues (20)
- Training errors on LIP HOT 4
- How can i run it on videos ? HOT 1
- LIP dataset not available HOT 3
- How to visualize edge prediction? HOT 1
- Where is the pre-trained model for Multiple Human Parsing?
- Training Time is huge
- CIHP dataset Training
- Testing on CPU HOT 12
- MulitHuman Parsing Resutls
- How to trained on custom dataset? HOT 2
- LIP dataset - crashed link HOT 1
- CUDA problem on training HOT 1
- generating human-parsing HOT 1
- Hi! I want to convert model to onnx but i have some error with InPlaceABNSync. can you give me some solutions. My error "RuntimeError: ONNX export failed: Couldn't export Python operator InPlaceABNSyn"
- Pascal-Person-Part求助
- Training with others backbone
- Excuse me, why is it stuck here all the time?I need help.
- Real-time test problem
- Cannot reproduce the results from the paper - Problem with InPlaceABNSync?
- 我下载到本地后,在pycharm上运行出的结果和colab上边运行的结果不一样是为啥呀??都是按照colab的步骤做的呀! HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from self-correction-human-parsing.