khdlr / hed-unet Goto Github PK
View Code? Open in Web Editor NEWSimultaneous Semantic Segmentation and Edge Detection
License: MIT License
Simultaneous Semantic Segmentation and Edge Detection
License: MIT License
I am grateful if you can provide the pre-trained weights for interence. Thanks!
hello,I am a beginner of studying segmentation.After carefully reading the code and paper you provided,I have some questions as follows:
**1.**I am not sure that which part of the code achieve the edge-detection function.I noticed that the HEDUNET in hed_unet.py seems to achieve only segmentation part. Can you tell me where the code is transferred to the HED edge detection task?
**2.**When I start to train my dataset,the result of“showexample” is very nice,SegAcc and EdgeAcc are very high. But when I use the trained model to test pictures,the result looks terrible. I am not sure that there is a problem with my code. My code is as follows:
cuda = True if torch.cuda.is_available() else False
device = torch.device('cpu' if torch.cuda.device_count() == 0
else 'cuda')
model = HEDUNet(input_channels=3, base_channels=16, stack_height=5, batch_norm=True)
model = model.to(device)
model.load_state_dict(torch.load(path_model))
model.eval()
image = np.expand_dims(image.transpose(2,0,1),0)
image = torch.from_numpy(image).to(device)
image = (image.to(torch.float) / 127.) - 1.
res, _ = model(image)
seg_pred, edge_pred = torch.sigmoid(res.squeeze())
pred = np.array(seg_pred.copy())
pred[pred > 0.5] = 255
pred[pred<=0.5] = 0
pred = pred.astype(np.uint8)
pred = pred.reshape((ImgLength, ImgLength))
predicts.append((pred))
pred = np.array(edge_pred.copy())*255
pred = pred.astype(np.uint8)
pred = pred.reshape((ImgLength, ImgLength))
predicts_edge.append((pred))
**3.**I suspect that the reason is "full_forward". Do I need to use "full_forward" when testing? But if it is called, how to fill in parameters like target and metrics?
Hi, I'm from China. After looking at your code, the clock points to the game data. On my side, a picture + a mask (all JPG) directory structure is: images / 1 jpg..... gt/1. Jpg, and you don't need cutting training (it seems that you have done this operation). I don't need it. Can you modify the code of load dataset to make it universal training? In addition, what's the speed of your network? Suppose it's an ordinary GPU; thank
I am confused about how you do the attention with the softmax? Is it in the channel dimension?
why it can be treated as attention? How can we use the code to do segmentation?
Hello, I want to know how to set the weight value in the weight map. Is there an example? thank you!
Sorry to bother you again.
1.Are semantic segmentation task and edge detection task independent of each other? Or do they have mutual influence?
My own thoughts:
In auto_weight_bce loss, the value of loss.mean() is the combination of two tasks(if the output_channel == 2).
2.What does the “beta” in auto_weight_bce loss mean?
My own thoughts:
It seems to have changed the shape of the target tensor from (B,C,H,W) to (B,C,1,1).
I guess it gave a weight to the two channels of each image in the batchsize.But I'm not sure why you're doing this?
Can we make the sum of the weights of the two channels of each predicted image at different resolution levels equal to 1 by doing this?
Hey can you please help me with the training steps? how can I use my dataset and its labels?
Hi, I used to train with a loss of 0 x. The effect is good. In the past two days, 1 / 5 of the new data types have been added on the basis of the original data: 6000 white masks (but I want him to learn this type of data because the pixels on the outermost edge are black). At present, 10 epochs have been trained, and loss has increased from 4 to 9, but the edge accuracy has increased slightly, 0.978; The final effect is to successfully learn this new type of data, but it can be more perfect. What causes the loss
After training.. how can we test our data?
The queries and the predictors seem to be the same.
So What are the differences between the results as follows?
1.full_scale_preds.append(F.interpolate(prediction, size=(H, W), mode='bilinear', align_corners=True))
2.queries = [F.interpolate(q(feat), size=(H, W), mode='bilinear', align_corners=True)
for q, feat in zip(self.queries, multilevel_features)]
Can the author provide code for prediction
Hello, I want to use your code to train multiple categories of objects and their edge detection. How to achieve it? How to make and read data? Can you give me a hint? It's best to have code examples.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.